Search notes:

HTML elements: table, tr, td, thead, tbody

<!DOCTYPE html>
<html>
<head>
  <meta content="text/html;charset=utf-8" http-equiv="Content-Type">
  <title>&lt;table&gt;</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>
Github repository about-html, path: /tags/table.html
See result on htmlpreview.github.io

td

vertical-align

Setting the value of the 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 &lt;td&gt; 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>

Misc

If present, the (optional) <caption> element must be the first element of the parant <table> element.
If the parent <table> element is the only descendent of a <figure> element, <figcaption> rather than <caption> should be used.
If present, the (optional?) <colgroup> element must be between the preceding (potentially absent/optional) <caption> and following <thead>, <th>, <tbody>, <tfoot> and <tr> elements.
The DOM interface for <caption> is HTMLTableCaptionElement (not HTMLCaptionElement, see HTMLElement inheritance).
The CSS style background-color, when applied to a <table>, does not color the <caption> area.

See also

CSS: border properties
Dynamically creating a HTML table with JavaScript
CSS examples:
HTML elements
CSS: property display and the values table, table-row and table-cell to create tables with divs only
The CSS property border-collapse controls whether cells (<td> elements?) inside a <table> share their borders with the adjacent cell or if the borders are drawn separately.
The PowerShell cmdLet ConvertTo-HTML.

Index