CSS hack for safari 5

gad*_*dss 6 css safari cross-browser css3 css-hack

我正在开发一个网页,当我测试交叉浏览测试时,我得到的CSS样式与我的谷歌浏览器和我的safari 5冲突.

我所有浏览器的代码(firefox,chrome,opera)

.flex-direction-nav-featured a{
       margin-top: 4%;
   } 
Run Code Online (Sandbox Code Playgroud)

我试试这个,但它不会工作

/* for safari only (wont work)*/
::root .flex-direction-nav-featured a{
    margin-top: 5%;
}
/* for safari only (but works with chrome also)*/
@media screen and (-webkit-min-device-pixel-ratio:0) {
      /* works with sfari and chrome */
   .flex-direction-nav-featured a{
       margin-top: 5%;
   } 

}
Run Code Online (Sandbox Code Playgroud)

是否存在仅针对Safari 5的CSS hack?我尝试过很多东西,但都没有用.

小智 13

您可能想尝试通过伪类阻止chrome:

@media screen and (-webkit-min-device-pixel-ratio:0) { 
    /* Safari and Chrome */
    .flex-direction-nav-featured a{
        margin-top: 4%;
    } 

    /* Safari only override */
    ::i-block-chrome,.flex-direction-nav-featured a{
        margin-top: 5%;
    } 
}
Run Code Online (Sandbox Code Playgroud)