CSS hacks-IE8, IE7, IE6 and Firefox

Source: Internet
Author: User
ArticleDirectory
    • Option 1: IE8 and Firefox using the same style, IE6 and IE7 using another
    • Option 2: IE8 and Firefox using the same style, IE6 and IE7 using their own styles different to IE8 and Firefox.
    • Option 3: similar to above, but if you need to target IE8 and Firefox separately.
    • Option 4: similar to above, but if you need to target Firefox 3 and Firefox 2 separately.

Option 1: IE8 and Firefox using the same style, IE6 and IE7 using another
# Block {margin-top: 5px;/* target only IE8 + Firefox browsers */* margin-top: 10px;/* target only IE7 and older browsers */}
Option 2: IE8 and Firefox using the same style, IE6 and IE7 using their own styles different to IE8 and Firefox.
# Block {margin-top: 5px;/* target only IE8 + Firefox browsers */} * html # block {/* Target IE6 only */margin-top: 50px ;} * + html # block-10 {/* Target IE7 only */margin-top: 100px ;}
Option 3: similar to above, but if you need to target IE8 and Firefox separately.
# Block {margin-top: 5px;/* target only IE8 + Firefox browsers */} # block-10, X: -Moz-any-link {/* target only Firefox, overriding the style above */margin-top: 20px ;} * html # block {/* Target IE6 only */margin-top: 50px;} * + html # block-10 {/* Target IE7 only */margin-top: 100px ;}
Option 4: similar to above, but if you need to target Firefox 3 and Firefox 2 separately.
# Block {margin-top: 5px;/* target only IE8 + Firefox browsers */} # block-10, X: -Moz-any-link {/* target only Firefox, overriding the style above */margin-top: 20px;} # block-10, X: -Moz-any-link, X: Default {/* Targets firefox 3.0 and newer, overriding the style above */margin-top: 30px ;} * html # block {/* Target IE6 only */margin-top: 50px;} * + html # block-10 {/* Target IE7 only */margin-top: 100px ;}

Hopefully this makes sense, I have tested it so hopefully it works for you. Feel free to give feedback or other solutions you have come into your SS.

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.