CSS Super Tips (6)

Source: Internet
Author: User
Tags define definition comments
css| Tips 15. Importing (import) and hiding CSS

Since older browsers do not support CSS, a common practice is to use the @import technique to hide the CSS. For example:

@import URL (main.css);

However, this method does not work for 4, which makes me very headache for a while. Later I used the following wording:

@import main.css;

This can also be hidden in the IE4 CSS, hehe, also saved 5 bytes. To learn more about @import syntax, see here "Centricle ' CSS Filter Chart"

16. For IE optimization

There are times when you need to define some special rules for IE bugs, there are too many CSS tips (hacks), and I use only two of these methods, and whether or not Microsoft is better at supporting CSS in the upcoming IE7 Beta, both of these are the safest.

    • 1. Method of annotation
      • (a) to hide a CSS definition in IE, you can use the selector (child-selector):
        Html>body p {
        /* Definition Content * *
        }
      • (b) The following wording is only understandable by IE browser (hidden from browser)
        * HTML P {
        * Declarations * *
        }
      • (c) There are times when you want Ie/win to be effective and ie/mac hidden, and you can use the backslash technique:
        /* */
        * HTML P {
        Declarations
        }
        /* */
    • 2. Method of conditional annotation (conditional comments)

      Another way, I think, than the CSS hacks more withstand the test is the use of Microsoft's private attribute condition annotation (conditional comments). In this way you can define some styles for IE without affecting the definition of the main style sheet. Just like this:

      <!--[If ie]>
      <link rel=stylesheet type=text/css href=ie.css/>
      <! [endif]-->



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.