Compatible with CSS Hack writing in different browsers

Source: Internet
Author: User

CSS Hack refers to embedding Code such as * and * html in CSS Code to facilitate independent control of the specific style of a browser. For example, some CSS Hack can only be identified by IE6 or IE7, while Firefox and other browsers cannot. This effectively controls the performance of CSS in different browsers and avoids writing multiple CSS files.

Here, Mango outlines common CSS Hack statements to help you better control page rendering:

1. * symbol

The IE browser can recognize the * symbol, but other browsers such as Firefox, Opera, and Chrome cannot recognize the * symbol.

For example, different text colors are displayed in Firefox and IE:

2 .! Important

IE7 not only recognizes * symbols, but also recognizes! Important, while IE6 can only recognize the former.

For example, different text colors are displayed in IE6 and IE7:

Combining browser features 1 and 2, you can identify Firefox, IE7, and IE6 in CSS and load different styles.
For example, three different text colors are displayed in Firefox, IE7, and IE6:

4. * html and * + html
IE core browsers can recognize * html and * + html, while Firefox and other non-IE core browsers cannot recognize.

For example, three different text colors are displayed in Firefox, IE7, and IE6:

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.