How CSS hack distinguishes between all IE browsers and non-IE browsers

Source: Internet
Author: User

There are many ways to do this online, for example, after testing the following conclusions, superfluous words are not said, straight into the topic:

1. All the inference IE browser

Positive solution: This is only recognized by the Le Browser, non-IE browser is not recognized.

<!--[If ie]>
<style type= "Text/css" >

.../* Detailed style */
</style>
<! [endif]-->

Misunderstanding: The following wording IE and non-IE browser can recognize

<!–[if ie]>
<style type= "Text/css" >

.../* Detailed style */
</style>
<! [endif]–>

2. Infer Non-IE browser

Myth 1: This type of notation. IE and non ie are not recognized

<!--[if! Ie]>
<style type= "Text/css" >
.../* Detailed style */

</style>
<!--<! [endif]-->

Myth 2: The following wording IE and non-IE browser can recognize

<!–[if! Ie]><!–>
<style type= "Text/css" >
.../* Detailed style */

</style>

<!–<! [endif]–>

Finally solved the way:

Write a style that all browsers recognize, and then write a style with the same name that only IE can recognize, so that you can distinguish between IE and non-ie effects.

I used to solve the difference between IE browser and non-ie browser border differences, style processing methods such as the following:

<!–[if! Ie]><!–>
<style type= "Text/css" >
. divbody{
margin-top:4px;
}
</style>
<!–<! [endif]–>

<!--[If ie]>
<style type= "Text/css" >
. divbody{
margin-top:0px;
}
</style>
<! [endif]-->

Not found right now only it is not the wording of IE browser recognition, small partners have a good way. Mr. Wang told the appreciation!

Copyright notice: This article Bo Master original articles, blogs, without consent may not be reproduced.

How CSS hack distinguishes between all IE browsers and non-IE browsers

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.