CKTIS / HTML
HTML-Konzept: tables
HTML-Tabellen beschreiben Daten, deren Bedeutung aus Zeilen-Spalten-Schnittpunkten statt nur aus visueller Ausrichtung entsteht.
Version: WHATWG HTML Living Standard; index snapshot date recorded separately
Syntax
<table><caption>…</caption><thead>…</thead><tbody>…</tbody></table>table enthält optional caption, Gruppen thead, tbody, tfoot sowie tr-Zeilen mit th- oder td-Zellen; Reihenfolge und Kontext folgen Inhaltsmodellen.
rowspan darf rowspan="0" sein und die restlichen Zeilen seiner Zeilengruppe erfassen; sonstige Spannen und colspan sind positiv, Zellen dürfen sich nicht überlappen.
Für einfache Köpfe nutzt scope row oder col; komplexe Tabellen verbinden headers mit id. Tabellen sind kein Seitenlayout.
Das Beispiel liest caption, die Sammlungen rows und tBodies, cellIndex sowie ausdrückliche headers und scope.
Beispiele
<!doctype html>
<meta charset="utf-8">
<table id="prices">
<caption>Prices</caption>
<thead><tr><th id="product" scope="col">Product</th><th id="amount" scope="col">Amount</th></tr></thead>
<tbody><tr><th id="widget" scope="row">Widget</th><td id="price" headers="widget amount">9</td></tr></tbody>
</table>
<output id="result"></output>
<script>
const table = document.querySelector("#prices");
const cell = document.querySelector("#price");
result.textContent = `caption=${table.caption.textContent}; rows=${table.rows.length}; bodies=${table.tBodies.length}; cellIndex=${cell.cellIndex}; headers=${cell.headers}; rowScope=${widget.scope}`;
</script>
Ergebnis
caption=Prices; rows=2; bodies=1; cellIndex=1; headers=widget amount; rowScope=row
Das Ergebnis bestätigt DOM-Raster und Autorenbeziehungen; Screenreader-Ausgabe und komplexe Kopfalgorithmen werden nicht simuliert.