Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

<center> tag and tables

Status
Not open for further replies.

ice78991

Programmer
Nov 20, 2006
216
I've been reviewing the following html code

<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" COLS="1" WIDTH="98%">
<TR>
<TD>
<CENTER><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" COLS="1" WIDTH="98%">
<TR>
<!--- <TD> HAS BEEN OMITTED HERE...WHY? --->
<CENTER><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" WIDTH="100%">
<TR>
<TD><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="4" COLS="2" WIDTH="100%">

ETC ETC

There is obviously a lot of nesting here !

My question is why has the author omitted a <td> tag before the <center> on the 8th line

I have been playing about with this omission and have had some unusual results. Can anyone explain what the difference is or is it simply that it is an error to leave out the <td> ? Is it advisable to use the <center> tag
 
To answer your question about using the center tag - I'd advise against it, as there are other methods that would work just as well.

You could give the enclosing TD an "align" attribute with value of "center" (or is it "middle? It's been so long since I've used tables!)... you could give the item to center a "margin" style of "0px auto"... for earlier IE browsers, you could also use a style of "text-align: center".

I'm assuming you have these tables for layout - why not switch to a table-less layout instead, and avoid all of these nesting issues?

Hope this helps,
Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top