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

Source: Internet
Author: User

There are many methods on the Internet, after the test of the following conclusions, superfluous words will not say, straight into the topic:

1. Determine all IE browsers

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

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

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

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

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

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

2. Judging non-IE browser

Myth 1: This type of writing, ie and non-IE are not recognized

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

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

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

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

</style>

<!–<! [endif]–>

Final Solution:

Write a style that all browsers recognize, and then write a style that only the IE browser 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, the style of processing as follows:

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

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

currently not found can only be recognized by non-IE browser wording, small partners have a good way, hope to inform, greatly appreciated!

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.