Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why would ie8 center text when the text-align is set to left?

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.

Screenshot of IE Developer tools illustrating the issue

like image 711
Gidgidonihah Avatar asked Nov 03 '09 22:11

Gidgidonihah


People also ask

How do I center align text to the left in CSS?

To center text in CSS, use the text-align property and define it with the value 'center. ' You can use this technique inside block elements, such as divs. You can also center text in HTML, which is useful if you only want to center individual elements on the page on a case-by-case basis.

How do I align text to the center right?

Select the text that you want to center. in the Page Setup group, and then click the Layout tab. In the Vertical alignment box, click Center. In the Apply to box, click Selected text, and then click OK.


1 Answers

A very elegant solution from haslayout.net:

th {
    text-align: inherit;
}
like image 157
David P Avatar answered Oct 12 '22 12:10

David P