9
votes

can anybody see why this is not working in Safari? On this site http://www.transurban.co.nz/newHomePage the 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); )

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>
1
What version of Safari, OS? caniuse.com/calcJohanVdR
Safari 5.1.7 Windows 7Grant
Note that safari implementation is buggy: developer.mozilla.org/en-US/docs/Web/CSS/calcSW4
Thanks. Can anybody suggest another way of getting this height? I'm looking at the CSS 3 Flexible Box Model approach as a possible solution too hacks.mozilla.org/2010/04/the-css-3-flexible-box-model Pity the calc(100% - isn't going to do it for me as it's nice and simple.Grant

1 Answers

13
votes

The -webkit-calc feature 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