views:

665

answers:

4

Using ie8's own dev tools it shows the elements text-align value as left, but it is rendered centered in ie8 standards mode. In quirks or ie7 standards, everything is correctly aligned left.

New user, so I can't post images, but check out: http://i35.tinypic.com/2afa9ky.png

A: 

text-align is hereditary. Does the parent tag (TABLE, I think) center text?

James Bailey
The table has a class setting text-align to left. The <th> does not inherit this.
Gidgidonihah
A: 

IIRC, the <th> element will still center and bold the text due to the browser's internal styling. This being a big reason why I've recently started using CSS Reset sheets in all my projects.

AnonJr
This could be the issue. ie8 is not inheriting from the table tag.I need to specifically state the rule for th to work in ie8.
Gidgidonihah
A: 

Try adding this to your head tag

<style>th{text-align: left; font-weight:normal;}</style>

If you have other tables on the page which you do not want to be affected by this change then you can apply a class to your table and style the elements of that table.

... <table class='work_in_IE'> ...


<style type="text/css">.work_in_IE  th{ text-align: left; font-weight:normal;}</style>
Kieran
+3  A: 

A very elegant solution from haslayout.net:

th { text-align: inherit; }

http://haslayout.net/css/Non-Inherited-TH-Text-Align-Bug

David P