<th> Tag Syntax

<body>
   ... flow content expected ...
   <table>
      <thead>
         <tr>
            <th colspan="n">...</th>
            ...
         </tr>
         <tr>
            <th>...</th>
            ...
         </tr>
         ...
      </thead>
      <tbody>
         ...
      </tbody>
   </table>
   ...
</body>
Rules for coding the HTML th element

Make sure you understand the difference between a tag and element and are familiar with the definitions of namespace and other HTML terms.

  1. Inside a tr element code one or more th elements, one for each heading cell in the row.
  2. Begin the element for each heading cell with a starting <th> tag. The element name uses lower case letters and should be in the HTML namespace, which it will pick up automatically from the xmlns attribute on the <html> tag.
  3. Include any attributes of the <th> tag as appropriate.The colspan attribute and rowspan attribute allow merging cells from multiple heading columns and/or rows.
  4. End the th element with a matching </th> closing tag. (To ensure tags match up properly, it helps to code the starting and ending tags first, then fill in between them.)
  5. Between the <th> starting tag and the </th> ending tag include the inner HTML flow content for the heading.
  6. Code separate th elements for any additional headings in the same table row before the </tr> tag for the end of the row.