This is an article about CSS hack. Article The CSS hack mentioned in this article is for the hack of the attributes in class and ID, and the order of arrangement is required. Today I want to talk about CSS hack for class and ID.
CopyCode The Code is as follows:
. Test {/* FF */
Height: 20px;
Background-color: orange;
}
* + Html. Test {/* IE7 */
Height: 20px;
Background-color: blue;
}
* Html. Test {/* IE6 */
Height: 20px;
Background-color: black;
}
Through the CSS code above, we can see that FF is the most obedient browser. To use hack in IE6 and IE7, you must add the class tag HTML in front. This is a good memory. IE6 adds * HTML, while IE7 adds * + HTML, which implies adding a version. The advantage of CSS hack for class and ID is that it does not take into account the order before and after, and is easy for management and acceptance by other people. It can also be used to control versions similar to JS browsers. The disadvantage is that a large amount of code is generated! Okay. Let's talk about this first.
After reading the above content, you can click the following effects to see the effects in different browsers. Orange indicates ff, blue indicates IE7, and black indicates IE6.
Xmlns = "http://www.w3.org/1999/xhtml">