IE6 and the !important rule 10.08.2008 @ 05:13pm 1 comments

There are some people out there that believe IE6 does not support the !important declaration but it does. However, it supports it in it's own IE6 way which I will explain.

It works fine as long as the property you are applying the !important rule to is only declared once in that selector. For example, the following would work fine in IE6:

#mybox {
    background-color: #f00;
    border: 1px solid #c00;
    height: 100px !important;
    padding: 20px;
    }

However, if you were to try this next block of code, it would not apply the !important height and will apply the other height declaration instead:

#mybox {
    background-color: #f00;
    border: 1px solid #c00;
    height: 100px !important;
    height: 150px;
    padding: 20px;
    }

So remember, only declare your property once within a selector if you would like it to be !important.

What people think...

There have been 1 comment(s) on this entry so far. Have something you'd like to say? Feel free to comment below.

Josh said...
13.11.2008 @ 09:54pm

I've always succumbed to the !important stuff when I need IE6 to behave. I count on the fact that it'll read that second declaration but all the other more standards-complaint browsers will not.

Add your thoughts

Fields in bold are required.

Add a comment



Who am I?

I am Jenna Smith - a front end web developer who has been busy coding XHTML & CSS for the last 6 years. If you are interested in seeing my work or getting in touch you can do so through my growldesign website.