<!DOCTYPE html> <html> <head> <meta content="text/html;charset=utf-8" http-equiv="Content-Type"> <title><table></title> </head> <body> <table> <caption>The table's caption</caption> <thead> <tr> <td>Header 1</td> <td>Header 2</td> </tr> </thead> <tbody> <tr> <td>foo</td><td>one</td> </tr><tr> <td>bar</td><td>two</td> </tr><tr> <td>baz</td><td>three</td> </tr> </tbody> <tfoot> <tr> <td>Footer 1</td> <td>Footer 2</td> </tr> </tfoot> </table> </body> </html>
vertical-align
to top makes a table look nicer, imho. <!DOCTYPE html> <html> <head> <meta content="text/html;charset=utf-8" http-equiv="Content-Type"> <title>vertical-algin in <td> elements</title> <style> table { width:250px; float: left; border-collapse: collapse; margin-right: 20px; } td { border: #124 solid 1px; } table#text-at-top td { vertical-align: top; } </style> </head> <body> <table> <tr><td>first line:</td><td>one two three four five six seven eight nine ten</td><td>foo bar baz</td></tr> <tr><td>second line:</td><td>bla etc.</td><td>eins zwei drei vier fünf sechs sieben acht neun zehn</td></tr> </table> <table id='text-at-top'> <tr><td>first line:</td><td>one two three four five six seven eight nine ten</td><td>foo bar baz</td></tr> <tr><td>second line:</td><td>bla etc.</td><td>eins zwei drei vier fünf sechs sieben acht neun zehn</td></tr> </table> </body> </html>
<caption>
element must be the first element of the parant <table>
element. <table>
element is the only descendent of a <figure>
element, <figcaption>
rather than <caption>
should be used. <colgroup>
element must be between the preceding (potentially absent/optional) <caption>
and following <thead>
, <th>
, <tbody>
, <tfoot>
and <tr>
elements. <caption>
is HTMLTableCaptionElement
(not HTMLCaptionElement
, see HTMLElement
inheritance). border-collapse
controls whether cells (<td>
elements?) inside a <table>
share their borders with the adjacent cell or if the borders are drawn separately. ConvertTo-HTML
.