This is an article about CSS HACK. The CSS HACK mentioned in this article is a HACK for attributes in class and id, and the order of arrangement has requirements. What I want to talk to you about today is CSS HACK for class and id.
.test{/*FF*/
height:20px;
background-color:orange;
}
* html .test{/*IE7*/
height:20px;
background-color:blue;
}
*html .test{/*IE6*/
height:20px;
background-color:black;
}
From the above CSS code, we can see that FF is still the most obedient browser. If you want to use HACK in IE6 and IE7, you must add the HTML tag in front. It's easy to remember here. IE6 adds *html, and IE7 adds *html, which implies that a version has been added. The advantage of CSS HACK done on class and id is that there is no need to take into account the order, and it is easy for management and other personnel to accept. It can also achieve similar JS browser version control through this HACK. The disadvantage may be that it generates a lot of code! Okay, let’s talk about these first.
After reading the above content, you can click on the effect below to see the effect in different browsers. Orange represents FF, blue represents IE7, and black represents IE6.