Special FF/IE6/IE7 Special CSS Hack_ experience Exchange

Source: Internet
Author: User
This is an article about CSS hack, this article refers to the CSS hack is for class, id the attributes of the hack, the order of arrangement are required. Today to talk to you about class, id do CSS HACK.
Copy Code code 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;
}



The above CSS code can see that FF is still the most obedient browser, in IE6 and IE7 if you want to use hack must be preceded by the addition of the Kraft tag HTML. Here is a good memory, IE6 plus *html, and IE7 plus *+html, hint added a version. The advantage of CSS hack by class, ID is that it does not have to take into account the sequence, and is easy for management and other people to accept, but also through this hack similar to the JS browser version of the control. The disadvantage is probably to produce a lot of code! Well, let's talk about that roughly.

Read above can click on the effect of the following in different browsers to see the effect, where the Orange representative FF, blue for IE7, black for IE6.
<textarea id="runcode77369"><! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "> <ptml xmlns=" http://www.w3.org/1999/xhtml "> <pead> <meta http-equiv=" Content-type "Content=" Tex t/html; Charset=utf-8 "/> <title> cloud-dwelling community www.jb51.net CSS hack</title> <style type=" text/css "> *{ma rgin:0; padding:0; }. test{/*ff*/height:20px; Background-color:orange; } *+html. test{/*ie7*/height:20px; Background-color:blue; } *html. test{/*ie6*/height:20px; Background-color:black; } </style> </pead> <div class= "test" ></div> <body> </body> </HTML&G T </textarea>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]
Related Article

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.