Why isn't this html table definition checked?

I get this W3C HTML validation error:

end tag for "table" which is not finished

for this code:

<table id="myTable">
</table>

This is my DOCTYPE:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

I thought the table definition was perfect !?

+5
source share
4 answers

If you look at the XHTML 1.0 Strict DTD , it indicates that the table requires at least one of TROR TBODY:

<!ELEMENT table
     (caption?, (col*|colgroup*), thead?, tfoot?, (tbody+|tr+))>
<!ELEMENT caption  %Inline;>
<!ELEMENT thead    (tr)+>
<!ELEMENT tfoot    (tr)+>
<!ELEMENT tbody    (tr)+>
<!ELEMENT colgroup (col)*>
<!ELEMENT col      EMPTY>
<!ELEMENT tr       (th|td)+>
<!ELEMENT th       %Flow;>
<!ELEMENT td       %Flow;>

TRin turn requires at least one of THor TD.

The icon +after the element name means that it must appear at least once.

+6
source

, tr td . , title

+3

XHTML 1.0 tbody tr. . DTD, :

<!ELEMENT table
     (caption?, (col*|colgroup*), thead?, tfoot?, (tbody+|tr+))>

.

+3

http://validator.w3.org/docs/errors.html

73: X,

, . <p><em>. </p> , <em> <p>. :

<p><em>...</em></p>

Another possibility is that you used an element that requires a child that you did not include. Consequently, the parent is not finished, not completed. For example, in HTML, an element must contain a child element, lists require corresponding list elements ( <ul>and <ol>require <li>; <dl>requires <dt>and <dd>), etc.

Your table must have at least one <tr>.

0
source

All Articles