CSS if hack compatible ie

Source: Internet
Author: User

1. Css If hack conditional syntax
<!--[if ie]> only IE <! [endif]-->
Only all win systems are self-identifying with IE
<!--[if IE 5.0]> only IE 5.0 <! [endif]-->
Only IE5.0 can identify
<!--[if GT ie 5.0]> only ie 5.0+ <! [endif]-->
IE5.0 shifting IE5.5 can be identified
<!--[if LT ie 6]> only ie 6-<! [endif]-->
Only IE6 recognizable
<!--[if GTE ie 6]> only ie 6/+ <! [endif]-->
IE6 and ie5.x below IE6 are recognizable

<!--[if LTE IE 7]> only IE 7/-<! [endif]-->
Only IE7 recognizable
<!--[if GTE ie 7]> only ie 7/+ <! [endif]-->
IE7 and IE6, ie5.x below IE7 are recognizable

<!--[if IE 8]> only ie 8/-<! [endif]-->
Only IE8 recognizable

<!--[if IE 9]> only ie 9/-<! [endif]-->
Only IE9 recognizable

Note : After if plus LT GTE have different effects (join other parameters the same)

    • <!–[if IE 8]> = IE8 only IE8 recognizable
    • <!–[if lt IE 8]> = IE7 or lower version

<!–[if GTE IE 8]> = above or equal to IE8 version

2. DIV+CSS instances
CSS instance one:
Let IE6-IE8 display different content, the DIV CSS code is as follows:

<! DOCTYPE html>
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>
<title>div If condition instance </title>
<body>
You are using:
<!--[if IE 7]>
<! [endif]-->
<!--[if IE 6]>
<! [endif]-->
<!--[if IE 8]>
<! [endif]-->

<!--[if IE 9]>
<! [endif]-->
<br><br>
<strong> Description </strong>: If your browser version is how much will show ie how much, for IE6-IE9 experiment </body>

Description: The above for different IE display different Web content Div+css instance experiment.

Div+css Example Two :
Let IE6-IE8 display different CSS style effects, the DIV CSS code is as follows:

<! DOCTYPE html>
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>
<title>css if condition hack instance </title>
<!--[if IE 6]>
<style type= "Text/css" >
. divcss{color: #F00;}
</style>
<! [endif]-->
<!--[if IE 7]>
<style type= "Text/css" >
. divcss{color: #FF0;}
</style>
<! [endif]-->
<!--[if IE 8]>
<style type= "Text/css" >
. divcss{color: #00F;}
</style>
<! [endif]-->

<!--[if IE 9]>
<style type= "Text/css" >
. divcss{color: #000;}
</style>
<! [endif]-->
<body>
<div class= "Divcss" >
DIV CSS Experiment Tip:<br>
I IE6 under the red color, under the IE7 is the yellow color, under the IE8 is the blue color, under the IE9 is the black
</div>
</body>

Note: The above experiment only experiment ie6-ie9 under if HACK.

The above content from the network reprint from http://www.poluoluo.com/jzxy/201104/127650.html

CSS if hack compatible ie

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.