IE style rule gotcha
I've been busy with massive project at the day job (launching soon, hope to mention it in detail here), and soon I'll be preoccupied with a C++ course, so I don't expect to be posting with any regular frequency here for the remainder of the summer.
I will share this, though: just because you can set style properties with a string:
elm.style.fontSize = "12px";
...doesn't mean IE will accept any old string:
elm.style.fontSize = "12px !important"; /* causes 'invalid argument' error in IE */
Firefox has no problem with this. Of course.
7 Comments:
The question is it generally allowed to use this "!important" statement inside a runtime style defintion or is this only allowed in CSS definition blocks.
You can also set the runtime style in IE which will make it more "important" to the browser.
Such a tease. Looking forward to hearing about the upcoming project.
just to elaborate on what wpbasti said... instead of .style. use .runtimeStyle. for IE.
I guess this occurs because something like
style.fontSize
is *NOT* the same as the corresponding css property, in this case:
font-size
style.fontSize is the object representation of that css property.
There's actuall
(Sorry, continuing my previous post)
There's actually a property that you can use to do this:
style.cssText
so,
style.cssText = "font-size = 30pt !important"
is happily swallowed by IE
what about the _height property.
min-height property not works in IE, but _height is work.
Find the way to fell your personal style! It's the most important part in your image!
Post a Comment
<< Home