Common css hack

Source: Internet
Author: User

Common css hack
I suddenly remembered the statistics I saw on CNZZ this morning. There were a large number of users using IE6 and 7, and my heart broke. Why are there so many people not worried about Microsoft giving up? Therefore, IE compatibility must be implemented. --Css hack is divided into three types: attribute hack, IE condition comment hack, CSS selector Hack 1, attribute hack. For this, I just want to say that there are all kinds of answers on the Internet, I only know how to copy and paste it. There are many errors. I don't know how to test it.

. MyClass {background-color: # f1ee18;/* all recognition */background-color: # 00deff \ 9;/* IE6, 7, 8, 9, 10 recognition, however, IE11 does not support this function. For example, test */background-color: # 00deff \ 0;/* IE8, 9, 10, and 11. It is said that there is also opera */background-color: # 00deff \ 9 \ 0;/* IE8, 9, 10 recognition */+ background-color: # a200ff;/* IE6, 7 recognition */* background-color: # a200ff;/* IE6, 7 recognition */_ background-color: #1e0bd1;/* IE6 recognition */}

 

Here, we should pay attention to the usage in IE6,
.myClass{background:red!important;background:green;}  

 

Then, green is displayed. What if I write like this?
.myClass{background:green;background:red!important;}  

 

Then you will find that the display background is red. Does IE6 know important? Of course it is wrong,
h1{ background: red!important; } h1{ background: green; }  

 

You will find that the above style will show red under IE6. If you do not know it, it should be green. 1 2. hack
<! -- [If ie]> <! [Endif] --> <! -- Of course, lt, gt, lte, gte, And! are also used ,! -->

 

3. the selector hack refers to the selector hack, which is actually quite a lot. For attribute selectors, IE6 does not support it, but IE7 and above support it.
[Attr * = val] // multiple values [attr ^ = val] [attr $ = val] [attr ~ = Val] // there is a space between values

 

The sibling selector and IE6 are not supported, but IE7 and above support p + h1. // h1 is adjacent to p, and both have the same parent element p ~ H1 // All h1 after p will be selected

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.