CSS Hack, csshack

Source: Internet
Author: User

CSS Hack, csshack

CSS Hack is a full-disclosure method for implementing Browser style compatibility. If you don't need it, try not to use it. However, for some browser bugs, such as the old version of IE, sometimes CSS Hack is a last resort. This article describes CSS Hack in detail. CSS Hack is mainly divided into two types: Property Tag Method and Selector prefix Method


Attribute tagging

[IE6 -]

For IE 6-browsers, use the underscore (_) and hyphen (-).


[IE7 -]

For IE7-browsers, you can use a lot of characters, including '~! @ # $ % ^ & * () = + {[]: <> ,.? /

However, the commonly used plus sign + and star number *


[IE10 -]

Use the suffix \ 9 to identify IE10-Browser


[IE8 +]

Use the suffix \ 0 to identify IE8 + browsers


[IE9, IE10]

Use the suffix \ 9 \ 0 to identify IE9 and 10 browsers



Selector prefix

[IE6 -]

Add * html in front of the selector to identify IE 6-Browser

[Note] * Whether there are spaces between html and html will take effect.

*html div{color:red}


Add * + html in front of the selector to identify IE 7 browsers

[Note] *, +, and html can take effect with or without spaces

*+html div{color:red}


@ Media \ 0 can be used in the outer layer of the selector to identify IE 8 browsers.

[Note] @ media and \ 0 must have spaces

@media \0{    div{color:red}}

[IE9 + and other non-ie browsers]

Add: root before selector to identify IE9 + and other non-ie browsers

:root div{color:red}

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.