IE 6 and table alignment

What, no web design posts in the last month? Disgraceful! :slight_smile:

Well, here’s one. I just recently found out from a client that when he views his site in IE 6, which he just upgraded to, all the text shows up as centered. Never did before. Doesn’t in any other browser. He took a look through my portfolio and found a couple of other sites where that happened too.

I checked into it – from what I can tell, what it’s doing is applying formatting found OUTSIDE the tables to text INSIDE the tables. No other browser has ever done that, to my knowledge. Usually you can leave table cells at the default horizontal alignment and the text shows up let-aligned. Not in IE 6!

So I had to go through the affected sites and change every (*^%$! table cell with text in it to align=left. Really annoying, but not as annoying as having the other clients affected find out for themselves.

Anyway, I thought I’d let other people know – if you have a site that uses tables for alignment (yes, I know, technically we’re all supposed to be using CSS positioning now, but that’s still kinda bleeding edge as far as I’m concerned), and has center or div=center tags outside the table, you’d be well advised to go through and set any table cells that contain text to align=left.

I shall refrain from ranting about my desire to send a bill to M*******t for the time I spent doing this…



I might be missing something, or didn’t understand your post… but wouldn’t it be easier to just close div/center tags before the table, then re-open them after? Rather than adding align=“left” to all cells?

You can still keep the tables centered by adding align=“center” to the table tag, and that will keep it centered without centering the cell text – even when the table doesn’t fall within center/div tags.

Make sense? ;p

I believe Lynx will also center all text within a table that’s contained in a or

element, too, because it basically ignores the table tags.

As somebody else said here, it’s better to use ALIGN=“CENTER” attributes on the particular elements you want to center, rather than putting big blocks of code inside a element.

– Dan