Is there such a thing as conditional comments for Chrome?
I have a page that renders differently in Chrome when compared to Firefox.
Thanks
Conditional comments are conditional statements interpreted by Microsoft Internet Explorer versions 5 through 9 in HTML source code. They can be used to provide and hide code to and from these versions of Internet Explorer. Conditional comments are not supported in Internet Explorer 10 and 11.
It's a valid HTML comment so that code is hidden to non-IE browsers and IE 10 and 11 as they do not support conditional comments.
You can target WebKit based browsers using this in your CSS
@media screen and (-webkit-min-device-pixel-ratio:0) {
Body {}
}
Perhaps this will help?
<!--[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>
Then you use CSS to tweak your styles specifically for Chrome.
Both HTML conditional comments and Javascript conditional compilation directives are only supported by Internet Explorer 4-8 to the best of my knowledge.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With