Monday, July 21, 2008

CSS Browser Detection


.myclass {
color: red; /* All browsers [Target: FF,NS] */
_color: green; /* IE6- [Target: IE6-] */
.color: blue; /* IE7, IE6- [Target: IE7] */
}
body:last-child:not(:root:root) .myclass {
color: purple; /* Safari, Konqueror [Target: Safari, Konqueror] */
}


For IE8 You can just use meta tag to make it behave like IE7 (Facebook, Google are using this technique)


<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />

No comments:

Post a Comment