Distinguish between Ie6,ie7 and IE8 with 4 characters

Source: Internet
Author: User
Tags versions

The main use of the browser is to distinguish the CSS hack, some people may already know the IE6 and IE7 methods, but today we add a way to distinguish IE8.

IE8 and IE8 the following versions

The key to distinguishing them is to add "9" after the style.

1.body {
2. color:red; * All browsers, of course * *
3. Color:green9; /* IE8 and below * *
4.}

 


Note that you must use "9", I tried to use "8", can not work, must be "9".

IE7 and IE7 the following versions

The key to distinguishing them is to add a "*" symbol to the front of the style, as follows:

1.body {
2. color:red; * All browsers, of course * *
3. Color:green9; /* IE8 and below * *
4. *color:yellow; /* IE7 and below * *
5.}


IE6

Many designers may already be familiar with the use of underscores in front of the style to distinguish IE6, which is no more than the "*" symbol, because it is only used to distinguish between IE6.

1.body {
2. color:red; * All browsers, of course * *
3. Color:green9; /* IE8 and below * *
4. *color:yellow; /* IE7 and below * *
5. _color:orange; * IE6 * *
6.}

Use CSS Hacks carefully

We do not advocate using CSS hacks on any occasion, but we recommend using conditional annotations. But understanding CSS hacks is not a bit useless, at least to show someone else ~ ~

Use CSS hacks, because it is not forward compatible, perhaps the latest browser does not buy the account, then your page will suffer. If you are using compatible IE6 only to change one or two attributes, it is advisable to use conditional annotations if the changes are large.

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.