The first is the CSS hack method.
Height: 20px;/* For Firefox */
* Height: 25px;/* For IE7 & IE6 */
_ Height: 20px;/* For IE6 */
Pay attention to the sequence.
This also belongs to CSS hack, but it is not as concise as above.
# Example {color: #333;}/* Moz */
* Html # example {color: #666;}/* IE6 */
* + Html # example {color: #999;}/* IE7 */
The second method is to use conditional annotations dedicated to IE.
<! -- Other browsers -->
<LINK rel = "stylesheet" type = "text/CSS" href = "css.css"/>
<! -- [If IE 7]>
<! -- Suitable for IE7 -->
<LINK rel = "stylesheet" type = "text/CSS" href = "ie7.css"/>
<! [Endif] -->
<! -- [If lte ie 6]>
<! -- Suitable for IE6 and later -->
<LINK rel = "stylesheet" type = "text/CSS" href = "ie.css"/>
<! [Endif] -->
The third method of CSS Filter is as follows.
Create a CSS style as follows:
# Item {
Width: 200px;
Height: 200px;
Background: red;
}
Create a new Div and use the CSS style defined above:
<Div id = "item"> some text here </div>
Add the lang attribute in the body representation. The Chinese character is Zh:
<Body lang = "en">
Now define another style for the DIV element:
*: Lang (en) # item {
Background: Green! Important;
}
This is intended for use! Important overwrites the original CSS style. Because the Lang selector ie7.0 does not support this sentence, it does not have any effect on this sentence, so it achieves the same effect in ie6.0, unfortunately, Safari does not support this attribute, so you need to add the following CSS style:
# Item: Empty {
Background: Green! Important
}
: The empty selector is a css3 specification. Although safari does not support this specification, this element is still selected, whether or not this element exists, now green will be available in browsers other than IE versions.
For compatibility with IE6 and FF, consider the previous! Important