CSS style judgment Browser

Source: Internet
Author: User

Original article address

Differences between IE6, IE7, IE8, and Firefox

# Tip {

Background: Blue;/* the Firefox background turns blue */

Background: Red \ 9;/* The IE8 background turns red */

* Background: black;/* The IE7 background turns black */

_ Background: orange;/* change the IE6 background to orange */

}

Read "\ 9" for IE series browsers, while "*" for IE6 and IE7 (MI font size). In addition, IE6 can recognize "_" (bottom line), so it can be written in order, this will allow the browser to correctly read and understand CSS syntax, so it can effectively differentiate ie versions and non-ie browsers (such as Firefox, opera, Google Chrome, Safari, etc ).

Difference between IE6 and IE7 (method 2)

# Tip {

Background: Black! Important;/* The IE7 background turns black */

Background: orange;/* change the background of IE6 to orange */

}

Because IE7 can read 「! Important; "but IE6 does not work, and the CSS read step is from top to bottom. Therefore, IE6 cannot be recognized when reading 「! Important directly jumps to the next line to read CSS, so the background color is orange.

Another trick

<Style. type = "text/CSS">
# Example {color: red;}/* Firefox */
* Html # example {color: Blue;}/* IE6 */
* + Html # example {color: green;}/* IE7 */
</Style>
</Head>
<Body>
<Div id = "example"> Firefox should be red, ie6.0 should be blue, and ie7.0 should be green. </Div>
</Body>

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.