Learning About the Header Cell Tag
This is for the header portion of the table cell. The correct tag would be <th> but it has to come after the <tr> tag. Pretty much think of this like the <td> tag except that it’s for the header. Here is what it looks like as a hypothetical example in the correct order.
<table><tr><th></th></tr></table>
This is exactly what it looks like and as far as the attributes; it is identical to the table cells with the <td> tags.
- bgcolor - changes the background color to whatever you wish for it. Can be done through color value code or the name of the color itself.
- align - determines alignment of text in cell.
- bordercolor - determines a color of cell's borders.
- height, width - determines height and width of cell in pixels.
- nowrap - disable word wrapping.
- valign - it adjusts the text into a vertical position. May have values "top", "middle", "bottom".
- colspan - used to make more than 1 column in width. Can be used when having a major heading and need to take up some space. Can be made as long as necessary but would be best to not to have it too many.
- rowspan - it puts a distance in the cells from the content.
- background - can add a background image but would be recommended not to because the text may or may not be readable and could potentially confuse the viewer as to what you are writing.
I’m going to show you a basic idea of what it looks like using the <th> tag alone. Keep in mind it has to come after the <tr> tag.
<th colspan=”3” valign=”middle” rowspan=”4”></th>
That concludes how the header cell tag operates. You should by now have a good understanding on how it works. Think of it as a <td> tag and it should be as easy as pie to understand.
HTML tables menu.