XML technologies / HTML & XHTML / Alphabetical list of HTML and XHTML elements / table
(Excerpt from "HTML & XHTML ─ kurz & gut" by Jennifer Niederst Robbins)
A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z
table
HTML 4.01 | HTML 5 |
<table> ... </table>
Marks a table displaying rows and columns of data or other information. The minimum elements needed to define a table are: table, to create the table itself, tr for a table row and td, to define individual cells within a column. The complete table model appears below.
Start/end tag
Required/required
Attributes
Core, internationalization, events, global HTML 5 attributes
align="left|right|center"Deprecated. Not in HTML 5. Aligns the table within the text flow, working like
alignfor theimgelement. The default alignment is left (left). The valuecenteris not universally supported.bgcolor="#rrggbb" oder "Farbname"Deprecated. Not in HTML 5. Defines a background color for the entire table using hexadecimal RGB values or a color name. However, colors should properly be defined with stylesheets.
border="Zahl"Not available in HTML 5. Sets the width in pixels of the outer border around the table and its cells. The value
0(zero) disables all borders. The default is1. Specifying the wordborderwithout a value creates a 1-pixel border. This is not valid in XHTML.cellpadding="Zahl"Not available in HTML 5. Defines the space in pixels between a cell’s edges and its content. The default is
1.cellspacing="Zahl"Not available in HTML 5. Defines the space in pixels between table cells. The default is
2.frame="void|above|below|hsides|lhs|rhs|vsides|box|border"Not available in HTML 5. Tells the browser where to draw borders around the table:
Value
Description
voidNo border (default)
aboveTop only
belowBottom only
hsidesTop and bottom only
vsidesLeft and right only
lhsLeft only
rhsRight only
boxAll four sides
borderAll four sides
Table: Possible values of the table attribute frame
height="Zahl" oder "Prozentwert"Not standards-compliant. Defines the minimum height of the entire table in pixels or as a percentage of its parent element. Since this element is not standards-compliant, documents using it will not validate.
rules="all|cols|groups|none|rows"Not available in HTML 5. Tells the browser where to draw rules within the table. If the attribute
borderhas a value greater than zero,rulesdefaults toall, unless otherwise specified. This attribute is not universally supported. Possible values are:Value
Description
allRules appear between all rows and columns.
collsRules appear only between columns.
groupsnoneNo rules (default)
rowsRules appear only between rows.
Table: Possible values of the table attribute rules
summary="Text"Contains a summary of the table’s content for nonvisual browsers. In HTML 5, authors are encouraged to use the element
captioninstead.width="Zahl" oder "Prozentwert"Not available in HTML 5. Defines the entire table’s width in pixels or as a percentage of its parent element.
Examples
A simple table with two rows and two columns:
<table width="70%" cellpadding="10">
<tr>
<td>Zelle 1</td><td>Zelle 2</td>
</tr>
<tr>
<td>Zelle 3</td><td>Zelle 4</td>
</tr>
</table> The correct order in the complete table model, shown here in HTML syntax, appears below. For details, see the entries for the elements caption, tbody, thead, tfoot, colgroup and col.
<table>
<caption>Angestelltengehälter und Eintrittsdaten</caption>
<colgroup id=" employeeinfo">
<col span="2" width="300">
<col span="1" width="100" class="date">
</colgroup>
<thead>
<tr>
<th>Angestellter</th><th>Gehalt</th><th>Eintrittsdatum</th>
</tr>
</thead>
<tfoot>
<tr><td colspan="3">Erstellt von Betty D. Boss</td></tr>
</tfoot>
<tbody>
<tr>
<td>Wilma</td><td>50.000</td><td>6. April 2010</td>
</tr>
<tr> ... (mehr Datenzellen) ...</tr>
<tr> ... (mehr Datenzellen) ...</tr>
</tbody>
</table>
|
Copyright © 2010 O’Reilly Verlag GmbH & Co. KG
You may print the online version for your private use.
Otherwise, this chapter from "HTML & XHTML ─ kurz & gut" is subject to the same provisions as the printed edition: the work, including all its parts, is protected by copyright. All rights are reserved, including reproduction, translation, microfilming, and storage and processing in electronic systems.
O’Reilly Verlag GmbH & Co. KG, Balthasarstraße 81, 50670 Köln, kommentar(at)oreilly.de