CSS Properties hack

Source: Internet
Author: User

We often use CSS properties hack to be compatible with different browsers or to set different property values for different browsers.

Description: This document is based on the compatibility test: Windows system; Ie6-ie10, Firefox6.0, Chrome13.0, Safari5.1, Opera11.51

Grammar:

selector {

Value:
_:
Select IE6 and below. The Connector (middle dash) (-) can also be used, in order to avoid confusion with some of the underlined properties, it is more appropriate to use an underscore (_).
*:
Select IE7 and below. such as: (+) and (#) can be used, but the industry to (*) the recognition of higher
\9:
Select ie6+
:
Choose ie8+ and Opera
[;p Roperty:value;]; :
Select WebKit Core Browser (Chrome,safari). IE7 and below can also be identified. 3 semicolons inside and outside the brackets must be preserved, before the first semicolon can be any rule or any number of rules
[; color: #f00;]; with [color: #f00; color: #f00;]; and [Margin:0;padding:0;color: #f00;]; is equivalent. The last rule in brackets is always in effect, so the first one is usually the simplest to use.
Description choose a different browser and version
    • Minimize the use of CSS hack. hack are risky, use caution
    • The default operating environment for all code and examples in this document is Standard mode, as is often not specifically stated.
    • Some CSS hack because of the cross-understanding of the browser, it is necessary to use layer-by-layer overlay to achieve the hack of different browsers. As the following example:

      If you want to display the same text in ie6,7,8 as a different color, you can write:

      .test{color:#090\9; /* For IE8+ */*color:#f00;  /* For IE7 and earlier */_color:#ff0;  /* For IE6 and earlier */}

      * The above hack are required to operate in the standard mode, if operating in the strange mode, these hack will be different versions of IE mutual recognition, resulting in failure.

      The final table summarizes:

CSS Properties hack

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.