Help with HTML validation error: Table column has no cells beginning in it
Asked Answered
D

8

24

Please help me with this validation error. I can't understand what it means or what's not standards complaint with my HTML.

I'll repost it here since hopefully I'll fix it and that link will no longer work:

Table column 2 established by element td has no cells beginning in it.

…="tooltip_table"><tr><td colspan="2">20 yd range</td></tr><tr><td colspan="2"
                                     ↑
Deficit answered 18/2, 2010 at 23:13 Comment(0)
A
12

HTML 5.2 Draft: Section 4.9.12.1 Forming a table

http://w3c.github.io/html/tabular-data.html#forming-a-table

Step 22: If there exists a row or column in the table containing only slots that do not have a cell anchored to them, then this is a table model error.

Alpenhorn answered 19/2, 2010 at 1:32 Comment(0)
A
19

When you say colspan="2", the column is supposed to stretch across two columns. My guess would be that there is no second column defined anywhere else in the able, thus making colspan="2" impossible (and unnecessary).

I can't find anything in the spec explicitly saying it's illegal. Maybe the table calculating algorithm quoted in that spec is different from 4.01, but it's way too late in my time zone to try and get around that :)

However, I find the error message makes too perfect sense to be an outright bug.

Table column 2 established by element td has no cells beginning in it.

By using colspan="2", you imply the existence of a second column, which doesn't exist in that case. Common sense tells me it is correct to nag about.

Maybe somebody can shed some light on this... Or it is, indeed, a bug.

Attract answered 18/2, 2010 at 23:22 Comment(4)
But that's not illegal as far as I know.. Do you have any source that says it is?Deficit
The table is not the only one like that in the document. However, only that table's markup errs.Julesjuley
@Glex I didn't see that, if that is true then it must be a bug.Attract
I had the same error for colspan, so I changed it from colspan="3" to colspan="2" and the error has gone.Dowlen
A
12

HTML 5.2 Draft: Section 4.9.12.1 Forming a table

http://w3c.github.io/html/tabular-data.html#forming-a-table

Step 22: If there exists a row or column in the table containing only slots that do not have a cell anchored to them, then this is a table model error.

Alpenhorn answered 19/2, 2010 at 1:32 Comment(0)
S
4

I believe it is a bug, and still unfixed. Consider this example page and run it through the W3C validator. It gives errors for "Table column 3 established by element td has no cells beginning in it.", and yet each table has 4 cells/columns, and the "colspan" of 2 is called on the second cell.

Subservience answered 21/4, 2011 at 22:43 Comment(3)
Also, for the record, that next table cell--I tried it with "display: hidden", which is the default, and I tried it without; in each case, the error comes up, so the CSS display (hidden or visible) of the cell is NOT what is causing this bug. I quadruple-checked this.Subservience
Also, I've added this bug to the Validator.nu Bugzilla list: linkSubservience
I think we've got it figured out. Needed another row with full cell count before using colspan. HTML5 picks up on the error, whereas previous doctypes let it slide.Subservience
J
2

Looks like an issue with the HTML5 validator. That error does not come up if you validate is with HTML 4.01 Transitional, and the table html has not been changed that much in html5.

http://validator.w3.org/check?uri=http://www.wowpanda.net/s9712&charset=(detect+automatically)&doctype=HTML+4.01+Transitional&ss=1&outline=1&group=0&verbose=1&user-agent=W3C_Validator/1.654

Reporting it is probably a good idea

Julesjuley answered 18/2, 2010 at 23:22 Comment(6)
HTML 5 and 4.01 are entirely different beasts, and the fact that the one applies a different rule set than the other is, even though it might, not necessarily a "bug." Without more evidence, I think there is no need for the b-word :)Attract
Point taken. However, before posting the answer I read this: w3.org/TR/html5/tabular-data.html And there is no evidence whatsoever that the <table><tr><td> structure changed that much. Let's call it an Issue, because we are not sure it is a bug :)Julesjuley
@Glex I just came back from reading the same document :) There's indeed nothing in there but to me, the error message makes too much sense to be a bug. Well, we'll see, if a report gets filed I would be interested to know what comes out of it.Attract
Henri Sivonen's validator says the same, so it would be a bug in two independent validators? (They are independent, aren't they?) html5.validator.nu/?doc=http%3A%2F%2Fwww.wowpanda.net%2Fs9712Unleash
@Marcel - I think they are one and the same.Alpenhorn
The legacy validator simply doesn't check for this class of error at all. This is an improvement over legacy--not a bug in the HTML5 validator.Reiser
E
1

I had the same error on a dynamically created table. Depending on the input, some rows were displayed or not. Like this:

Causes no error:

<table>
<tr>
<td> cell 1 in row 1 </td>
<td> cell 2 in row 1 </td>
</tr>
<tr>
<td colspan=2> one cell in row 2 </td>
</tr>
</table>

Causes no error:

<table>
<tr>
<td> cell 1 in row 1 </td>
<td> cell 2 in row 1 </td>
</tr>
</table>

Causes an error:

<table>
<tr>
<td colspan=2> one cell in what is now the only row </td>
</tr>
</table>

Once I programmed the page to delete the colspan from the last example when the first row was not displayed, the error disappeared. Something like this:

<?php if (first row with two cells is displayed) echo 'colspan=2'; ?>

I find this logical. colspan=2 with only single cells is like telling someone visiting me to turn right on a street that does not have any junctions, believing that they will continue straight on. They won't. Instead they will get hung up searching for something that is not there. Maybe not a completely accurate analogy, but you can imagine a dumb browser creating display errors while looking for stuff that you tell it is there, but is not. Browsers shouldn't be expected to "think" that maybe you meant your code differently from how you wrote it.

Equestrienne answered 10/6, 2010 at 19:27 Comment(0)
A
1

Just fixing the link for Alohci's answer.

https://w3c.github.io/html/single-page.html#forming-a-table

  1. If there exists a row or column in the table containing only slots that do not have a cell anchored to them, then this is a table model error.
Aemia answered 15/9, 2016 at 12:55 Comment(0)
T
0

This thread is a bit old but I post this for anyone bumping into it.

Defining each column using tag removes the message and also gives the colspan something to relate to.

More info in the answer here: Why is colspan not applied as expected

Tigre answered 13/2, 2012 at 9:13 Comment(0)
P
0

If you initiate the table - it fixes the validation column errors. If your table has 8 columns then the first row must have 8 elements, which if you are only initiating you don't want to see. The css element is: tr.Init{border:none;} and the following first row of an 8 column table. The result is - you don't see the first row and your validation errors are fixed.

Pardew answered 1/2, 2014 at 20:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.