Skip to content Skip to sidebar Skip to footer

Are Html Tables Valid If There Are Multiple Tbody Tag Used?

If there are multiple tags in an HTML , is this valid?

Solution 1:

Yes, the DTD shows that it is allowed.

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

The DTD also has a comment which explains why:

Use multiple tbody sections when rules are needed between groups of table rows.


Solution 2:

I copy pasted your title in google and the first link is : http://www.w3.org/TR/html401/struct/tables.html#h-11.2.3 ,

"Table rows may be grouped into a table head, table foot, and one or more table body sections",

so yes you can !


Solution 3:

Multiple table bodies is perfectly acceptable.


Solution 4:

Yes, you can have multiple tbodys in the same table.

Example:

<table>
    <tbody>
        <tr><td>Monday</td><td>#1</td></tr>
        <tr><td>Friday</td><td>#2</td></tr>
    </tbody>
    <tbody>
        <tr><td>Monday</td><td>#3</td></tr>
        <tr><td>Friday</td><td>#4</td></tr>
    </tbody>
</table>

Post a Comment for "Are Html Tables Valid If There Are Multiple Tbody Tag Used?"