Welcome to WebmasterWorld Guest from

Forum Moderators: incrediBILL

Message Too Old, No Replies

div align, align & valign

Trying to cut down on code



12:09 pm on Oct 2, 2001 (gmt 0)

10+ Year Member

Hi, Often I use a mixture of the above (to be on the safe side!) for text and image alignment within cells, but wondered if its ok to cut down on them and still be safe in all browsers. I thought maybe only right and middle alignment might be the only needed, as browsers might default to top and left. Any tips would be much appreciated. I understand browser support for CSS text-align is not too wide, so this seems the safer bet but results in more code. TIA.


5:40 pm on Oct 2, 2001 (gmt 0)

WebmasterWorld Senior Member tedster is a WebmasterWorld Top Contributor of All Time 10+ Year Member


I'd say your intuition makes sense -- there's usually no reason to insert the defaults (align="left" or valign="middle") unless you are overriding some previously declared positioning. There's also little reason to declare alignment in the TD tag and then also use a DIV tag for the same purpose.

A <p align="center"> can often take care of alignment changes within a table cell. Extra background color (in a jpg) or transparency (in a gif) can help position an image properly.

As far as CSS support for text-align, the only issues I'm aware of are for "justify" [in NN4 and IE3, both PC and Mac]. Other values are clear sailing.

I personally find code with lots of "insurance" declarations very crazy to maintain, so I using prefer one tag per result. For the same reason, I am learning to avoid layout tables when I use CSS.


7:04 pm on Oct 2, 2001 (gmt 0)

10+ Year Member

Excellent advice, tedster!


10:43 am on Oct 3, 2001 (gmt 0)

10+ Year Member

Thanks very much for your time and great advice Tedster. <p align="centre"> just sorted out a legacy of an NN problem!!

Featured Threads

Hot Threads This Week

Hot Threads This Month