CSS 高度:-webkit-calc(100% - 155px); 无法在 Safari 中工作

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/23322954/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 02:20:02  来源:igfitidea点击:

height: -webkit-calc(100% - 155px); not working in Safari

csssafari

提问by Grant

can anybody see why this is not working in Safari? On this site http://www.transurban.co.nz/newHomePagethe div containing the slider has it's height calculated using height: calc(100% - 155px); It works perfectly for all browsers apart from Safari (Safari specific = height: -webkit-calc(100% - 155px); )

有人能明白为什么这在 Safari 中不起作用吗?在这个网站http://www.transurban.co.nz/newHomePage包含滑块的 div 的高度使用 height: calc(100% - 155px); 它适用于除 Safari 之外的所有浏览器(Safari 特定 = 高度:-webkit-calc(100% - 155px);)

Any assistance/suggestions greatly appreciated.

非常感谢任何帮助/建议。

  CSS
  html, body, #wrapper { height: 100%; }

  #headerHome {height:146px;}
  #center {
    height: 100%;
    width:100%;
    overflow: hidden;
    height: -moz-calc(100% - 155px);  
    height: -webkit-calc(100% - 155px);     
    height: calc(100% - 155px); 
  }
  .sliderBox{
    width:100%;
    height:100%;
  }

   HTML

  <div id="wrapper">
        <div id="headerHome">
            HEADER STUFF 
        </div>
        <div class="redBorder"></div>
        <div id="center">                
            <div class="sliderBox">
               SLIDER STUFF HERE                    
            </div>                
           <div class="centralWrap">
        MAIN CONTENT HERE           
          </div>
       </div>
    </div>

回答by KittMedia

The -webkit-calcfeature of Safari just works (buggy) for version 6 and later. It will never work on Windows (Safari for Windows is outdated and should not be used anymore). https://developer.mozilla.org/en-US/docs/Web/CSS/calc

-webkit-calcSafari的功能仅适用于版本 6 及更高版本(有问题)。它永远不会在 Windows 上运行(Safari for Windows 已经过时,不应再使用)。 https://developer.mozilla.org/en-US/docs/Web/CSS/calc