CSS for specific browsers: IE Chrome Firefox CSS Hack and csschrome

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.