Home >Web Front-end >CSS Tutorial >Extraordinary CSS HACK for FF/IE6/IE7_Experience exchange

Extraordinary CSS HACK for FF/IE6/IE7_Experience exchange

WBOY
WBOYOriginal
2016-05-16 12:06:291276browse

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.                     

Copy code 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;
}



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.​

[Ctrl A Select all Note:If you need to introduce external Js, you need to refresh it to execute]
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn