0

Could you please help me to add a conditional css for all version of Safari.

I have used this but that only works for windows safari 5.1.7 but it doesnt work with OSx Safari 7.0.3

@media screen and (-webkit-min-device-pixel-ratio:0) { 
    /* Safari only override */
    ::i-block-chrome,.extraheight {
        height: 180px !important;
    } 
}

Thanks!

weby
  • 1
  • 2
  • What are you trying to accomplish? Safari-only css seems like a workaround... – random_user_name Apr 23 '14 at 16:55
  • 3
    You should present the problem, because there might be a possible crossbrowser solution, rather than using workarounds. – easwee Apr 23 '14 at 16:56
  • listen to @easwee. However, this might be helpful: http://stackoverflow.com/a/9851769/2387772 – yuvi Apr 23 '14 at 17:05
  • Yes that only the way I am trying to find that the above conditional css rule is not working for Safari 7.0.3.. any clue? – weby Apr 23 '14 at 17:06
  • It seems that webkit is not detecting.. anyone knows the correct way to implement this conditional css for Safari 7.0.3.. I know this new versions has many css bugs so not sure what to do with it. – weby Apr 23 '14 at 18:25
  • The code you posted worked only for Safari up to version 6.0 (not 6.1 and above) – Jeff Clayton Dec 13 '14 at 16:43

1 Answers1

2

There is no single one for all versions of Safari, just different versions can be targeted with different types of hacks. This one is the latest, and the product of months of my own research and experimentation:

/* Safari 6.1+ (8.0 is the latest version of Safari at this time) */

@media screen and (min-color-index:0) and(-webkit-min-device-pixel-ratio:0) { @media
{
    .safari_only { 

        color:#0000FF; 
        background-color:#CCCCCC; 

    }
}}

If you want to test it live (and many others I have been working on for different browsers) check my live test page at: http://browserstrangeness.github.io/css_hacks.html#safari

or mirror at:

http://browserstrangeness.bitbucket.io/css_hacks.html#safari

Jeff Clayton
  • 7,053
  • 1
  • 31
  • 36