CSS for specific browsers: IE Chrome Firefox CSS Hack and csschrome
CSSHack of Firefox
CSS Hack is applied only on Firefox. Although this situation is rare, it is sometimes encountered:
@-moz-document url-prefix() {
.cssSelector {
font-size: 14px;
}
}
Chrome CSSHack
CSS Hack applied only on Chrome, which has not been met yet (why Chrome is used as a browser development ?), Be prepared.
@media screen and (-webkit-min-device-pixel-ratio:0) { #test1{color:red;}}
CSS Hack for IE6, 7/8, and 9 +
CSS Hack is applied only on IE. This situation is almost always encountered. Here we use a common method, which is complicated. We need to first divide the version:
Append an IE-version class to the body.
Hack CSS is written together with other CSS files.
IE9 + without Hack; IE6, IE7, IE8 with ie's front-end servers; IE6 with another ie6's front-end servers Hack (most of the hack written to ie7/8 will be used by IE6)
<!--[if lt IE 7 ]><body class="ie ie6"><![endif]--><!--[if IE 7]><body class="ie"><![endif]-->
<!--[if IE 8]><body class="ie"><![endif]-->
Attaches a new CSS file to IE
Add one more for IE7/8, and two more for IE6, so that IE can add more things and do not pollute other CSS files.
<!--[if lt IE 9]>
<link type="text/css" rel="stylesheet" href="css/show_ie.css">
<![endif]-->
<!--[if lt IE 7]>
<link type="text/css" rel="stylesheet" href="css/show_ie6.css">
<![endif]-->
Note * lt indicates less than; that is, "ifless than IE9" = "if lt IE 9". There are a few more, but they are rarely used.
gt: Greater
lte: Less than or equal