What does td mean in HTML

table td / th • Cell of an HTML table

Table cells, table rows

Table cells are generated by th or td tags and must be located within tr tags.

A table row tr can contain any number of table cells and header cells.

While th is reserved for the head of the table, a table cell with td can contain any content. The browsers render the content of th tags in bold and centered; the content of td tags is left-justified in normal font.

Except for this visual difference behave th- and tdElements the same.

The browsers show without special formatting by CSS td and th without frame. With CSS border table cells have a double frame because table cells are spaced a little apart. CSS border-collapse eliminates the spacing and the frames collapse into a line.

HTML td

HTML table creates with tr, td and th a grid for organizing data in rows and columns. The sequence of tags within a table row is

<table> <tr><td> here is the content </td></tr> </table>

There must be the same number of cells in all rows of a table. The rowspan or colspan attribute connects table cells lying next to or one below the other.

MondayTuesdayWednesdayThursdayFriday
physicsFree hoursSports
mathematicsGermanEnglish
<table> <tr> <th>Montag</th><th>Dienstag</th><th>Mittwoch</th> <th>Donnerstag</th><th>Freitag</th> </tr> <tr> <td rowspan="2">Physik</td> <td colspan="3">Freistunden</td> <td rowspan="2">Sport</td> </tr> <tr> <td>Mathematik</td><td>Deutsch</td><td>Englisch</td> </tr> </table>

HTML th

th shows the cells of an HTML table as the table header. Heading cells can contain headings and information about the columns or rows of a table. Without CSS shows th the content of the table cell is bold and centered.

In th headings and information can be placed over the columns or rows of a table.

th tags do not necessarily have to be the first line of a table. The first table cell of the table series can just as well be used as a header with a th tag.

RosesTulipsPoppy
Rosa centifoliaRecreadoCorn poppy
Rosa gallicaTulipa tardaOpium poppy
RosesRosa centifoliaRosa gallica
TulipsRecreadoTulipa tarda
Rosa gallicaTulipa tardaOpium poppy

Table cells in th tags are displayed with a border by the browser if no CSS styles are set for th. Without CSS, each table cell becomes as wide as its content. When the table has reached the full width of the comprehensive box, texts are wrapped in th tags.

<table> <tr> <th>Rosen</th><th>Tulpen</th><th>Mohn</th> </tr> <tr> <td>Rosa centifolia</td><td>Recreado</td><td>Klatschmohn</td> </tr> … </table> <table> <tr> <th>Rosen</th><td>Rosa centifolia</td><td>Rosa gallica</td> </tr> <tr> <th>Tulpen</th><td>Recreado</td><td>Tulipa tarda</td> </tr> … </table>

Attributes for td and th

colspan
spans a cell over several columns. It can also use the attribute rowspan can be combined to build a table cell over several rows and columns.
headers
is a list of cell names derived from the id- Attributes of the cells originate. The attribute headers is used by browsers for speech output and is not recognized by most screen browsers.
rowspan
allows a cell to span two or more rows. It can be used together with the attribute colspan can be used, with which a cell can span several columns.
scope (no longer in HTML5)
scope assigns a header cell to a set of data cells. The four possible values ​​are col, colgroup, row and rowgroup.
abbr (no longer in HTML5)
Abbreviated version of the contents of a cell
align (no longer in HTML5)
Aligns table cells using a character (e.g. a comma or a "%" character). In XHTML, the only assignable value is "char".
axis (no longer in HTML5)
creates a list of category names to group columns or rows of a table.
char (no longer in HTML5)
Character for the alignment of decimal places in a cell.
charoff (no longer in HTML5)
integer for the distance of the character from the cell edge.