IE - can get actual CSS style, not computed style?

N

Nik Coughlin

I know IE doesn't support "display: table", but when I examine an element
with that style, eg. alert( element.style.display ) it gives me "block". Is
there any way I can get the actual value that's in my CSS or does IE discard
things it doesn't understand like "display: table" when it's building the
DOM?
 
D

David Mark

I know IE doesn't support "display: table", but when I examine an element
Right.

with that style, eg. alert( element.style.display ) it gives me "block".  Is

That's IE's default display style for tables.
there any way I can get the actual value that's in my CSS or does IE discard

You could try the document.styleSheets collection, but I doubt you
will find it in there.
things it doesn't understand like "display: table" when it's building the
DOM?

Yes.
 
N

Nik Coughlin

That's IE's default display style for tables.


You could try the document.styleSheets collection, but I doubt you
will find it in there.


Yes.

OK. The reason that I ask is because I have written an IE behavior that
looks for elements that are supposed to be display: table, display:
table-row, display: table-cell etc. and rewrites the DOM so that they are
actually a table, table row, table cell etc. It works perfectly except that
in order to find the elements I'm currently tagging the elements with class
names in the HTML and it would be a lot cleaner if I could just check the
styles. Looks like I'll have to stick with the current method, which is a
pity because it requires altering the HTML to work.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top