Chrome条件评论

Vin*_*cio 26 css firefox google-chrome

是否有针对Chrome的条件评论这样的事情?

与Firefox相比,我在Chrome中的页面呈现方式不同.

谢谢

Geo*_*mbe 54

您可以在CSS中使用此目标来定位基于WebKit的浏览器

@media screen and (-webkit-min-device-pixel-ratio:0) { 

Body {}

}
Run Code Online (Sandbox Code Playgroud)

也许这会有所帮助吗?


Dmi*_*ryK 13

<!--[if IE 8]><div id="bodyContainer" class="IE8"><![endif]-->
<!--[if !IE]>--><div id="bodyContainer" class="W3C"><!--<![endif]-->
<script type="text/javascript"> 
    if (navigator.userAgent.toLowerCase().match('chrome') && document.getElementById('bodyContainer'))
        document.getElementById('bodyContainer').className = document.getElementById('bodyContainer').className + " chrome";
</script>
Run Code Online (Sandbox Code Playgroud)

然后使用CSS专门针对Chrome调整样式.


dpq*_*dpq 5

据我所知,只有Internet Explorer 4-8支持HTML 条件注释和Javascript 条件编译指令.