Log in

View Full Version : HTML 4.01 Strict Table Errors



questions
08-05-2008, 06:01 PM
Using HTML 4.01 Strict, I get errors on http://validator.w3.org in the table widths and heights. I checked the language online here http://www.w3.org/TR/REC-html40/struct/tables.html and I can't understand why.

These are the errors:

1. there is no attribute "HEIGHT".
<table width="1200" height="231"cellpadding="0" cellspacing="0" border="0">

2. there is no attribute "WIDTH".
<tr><td width="1200" align="left">

3. there is no attribute "HEIGHT".
<tr height="53"valign="bottom">

4. there is no attribute "BGCOLOR".
<table width="990" height="330" bgcolor="#ffffff" cellpadding="0" cellspacing="0

Thanks!

Medyman
08-05-2008, 07:40 PM
Those attributes aren't supported in the WC3 HTML 4.01 Strict standard. You should be using CSS to declare those attributes.


table {
height:231px;
width:1200px
background-color:#fff;
}
td {
width:1200px;
text-align:left;
}
tr {
height:53px;
vertical-align:bottom;
}

questions
08-05-2008, 08:46 PM
Cool! Thank you! I was starting to think that...

questions
08-05-2008, 09:03 PM
And if you have two or more tables, do you do something like this:

CSS
table.table1 {
height:231px;
width:1200px
background-color:#fff;
}
td.table1 {
width:1200px;
text-align:left;
}
tr.table1 {
height:53px;
vertical-align:bottom;
}

HTML
<table class="table1">
<tr>
<td>content</td>
</tr>
</table>

And if you have more than one row or cell size you give each one a tag?
td.table1row1
etc.?

Thanks!

questions
08-06-2008, 12:23 AM
I've decided to define them as classes like this. Couldn't figure it out any other way.

CSS
.menutable {
height: 240x;
width: 1035px
background: #fff;
}
.menurow {
height: 60px;
vertical-align: top;
}
.menucell {
width: 207px;
text-align: right;
}

HTML
<table class="menutable" border="0" cellpadding="0" cellspacing="0">
<tr class="menurow">
<td class="menucell"><a href="border/border.shtml" id="menu-border">&nbsp;</a></td>

TheJoshMan
08-06-2008, 12:27 AM
that's the best way to do it. If you want to define different things for each, then you should give them each classes and code the css correspondingly

rangana
08-06-2008, 12:39 AM
Don't miss highlighted:


.menutable {
height: 240x;
width: 1035px;
background: #fff;
}


You'll have unfavorable result.

techno_race
08-14-2008, 11:23 PM
Not if it spans multiple lines.