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!

Failed validation because on HTML table layout 1

Status
Not open for further replies.

leeboycymru

Programmer
Jan 23, 2007
185
GB
I have a table, which I have posted below without any of the php included. It is failing a validation because it says Im missing an child element, I have tried and tried and dont seem to be able to figure it out.

Code:
<table width="100%" border="0" align="left" cellpadding="0" cellspacing="0" >
  	<tr> 
          	    <td>&nbsp;</td>
   	</tr>
<tr> 
<td>
<table border="0" align="left" cellpadding="0" cellspacing="0" width="98%" >
<tr> 
<td width="<? if($j==1) { print("228"); } else { print("242"); } ?>" align="left" valign="top">
<table width="217" border="0" cellspacing="0" cellpadding="0">
<tr> 
<td align="left" valign="middle"><table width="201" border="0" cellspacing="0" cellpadding="0">
 <tr> 
<td align="left" valign="top">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr> 
<td width="62" height="63" align="left" valign="top"></td>
<td width="7">&nbsp;</td>
<td width="132" align="left" valign="top"><span class="bahia"></td>
        </tr>
    </table>
</td>
</tr>
<tr> 
                  <td height="1" align="left" valign="top" bgcolor="#CCCCCC"></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td width="1" bgcolor="#CCCCCC"></td>
</tr>
</table>
</td>
</tr>
</table>

Here is the validation page:


Not this is how the code is, and I have been through the code with a fine toothcomb, indenting it and the like to find the problem. Have a go and see if you can do it.

Can anybody spot the deliberate mistake.

Lee
 
Hi

Between lines 335 and 336 should be the data of the table. In XHTML you can not have [tt]<table></table>[/tt] without any data between them.
Code:
[highlight silver]334[/highlight]<tr> 
[highlight silver]335[/highlight]<td><table border="0" align="left" cellpadding="0" cellspacing="0" width="98%" >
[highlight silver]336[/highlight]</table>
[highlight silver]337[/highlight]</td>

Feherke.
 
Eek!

And here is why we don't use tables for layout anymore! ;-)

I originally thought you hadn't closed a td or tr around line 26-28 but looking again I think Feherke may be correct.

<honk>*:O)</honk>

Tyres: Mine's a pint of the black stuff.
Mike: You can't drink a pint of Bovril.
 
ye your right, and that will explain my other problem which I did have help for, but just couldnt get my head around it.

Thanks Feherke, I need to sort out the previous problem to sort this one out.

Lee
 
And here is why we don't use tables for layout anymore!

I take it that's the royal 'WE' , coz this is the only place I know that give a ****, where tables for layout is concerned - lol

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!
 
this is the only place I know that give a ****, where tables for layout is concerned

You don't hang out with the cool kids then ;-)

<honk>*:O)</honk>

Tyres: Mine's a pint of the black stuff.
Mike: You can't drink a pint of Bovril.
 
I do now ;-)



"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top