English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML Referenzhandbuch

Vollständiges Verzeichnis der HTML-Tags

HTML: <caption> Tag

Das HTML <caption>-Tag definiert den Titel der Tabelle in einem HTML-Dokument. Traditionell rendern Browser den Text im <caption>-Tag oben in der Tabelle, aber Sie können CSS caption-Die side-Eigenschaft ändert dieses Verhalten. Dieser Tag wird oft auch als <caption>-Element bezeichnet.

Das HTML <caption>-Element (oder das HTML-Tabelle-Überschriftselement) zeigt eine Tabelle an, es erscheint oft als erster Unter-element des <table> und wird am Anfang des Tabelleninhalts angezeigt, kann aber auch mit CSS gestylt werden, daher kann es an jeder beliebigen Position relativ zur Tabelle erscheinen.

Online-Beispiel

Tabelle mit Caption-Überschrift:

<!doctype html>
<html>
<kopf>
<meta charset="UTF-8">
<titel>Grundlagen-Tutorial-Website(w3(codebox.com)</titel> 
</kopf>
<body>
<table>
  <überschrift>Dies ist der Überschrifttext für die Tabelle</überschrift>
  <tr>
    <th>Spalte 1 Überschrift</th>
    <th>Spalte 2 Überschrift</th>
    <th>Spalte 3 Überschrift</th>
  </tr>
  <tr>
    <td>Daten in der Spalte 1, Zeile 2</td>
    <td>Daten in der Spalte 2, Zeile 2</td>
    <td>Daten in der Spalte 3, Zeile 2</td>
  </tr>
  <tr>
    <td>Daten in der Spalte 1, Zeile 3</td>
    <td>Daten in der Spalte 2, Zeile 3</td>
    <td>Daten in der Spalte 3, Zeile 3</td>
  </tr>
  <tr>
    <td>Daten in der Spalte 1, Zeile 4</td>
    <td>Daten in der Spalte 2, Zeile 4</td>
    <td>Daten in der Spalte 3, Zeile 4</td>
  </tr>
</table>
</body>
</html>
Testen Sie es heraus ‹/›
In diesem HTML5In der Dokumentbeispiel haben wir mit dem <table>-Tag eine Tabelle erstellt. Der erste ist <caption>. Dann hat diese Tabelle3Spalten und4Zeilen.1durch das erste <tr>-Tag definiert. Es hat3Zellen, die mit dem <th>-Tag definiert sind, sind Tabellenkopfzellen. Die Zeile dieser Tabelle ist2bis4Zeilen werden mit dem <td>-Tag definiert, um Standardzellen der Tabelle zu erstellen.

Kompatibilität der Browser

IEFirefoxOperaChromeSafari

Alle gängigen Browser unterstützen das <caption>-Tag.

Definition und Verwendung der Tags

Das HTML <caption>-Element befindet sich innerhalb des <body>-Tags.
Das <caption>-Tag tritt als erster nach dem <table>-Tag auf.

The <table> tag is composed of <tr>, <th>, and <td> tags.

Most browsers will display the <caption> tag above the table, but you can use CSS caption-The side attribute changes this behavior.

The <caption> tag defines the title of the table.

The <caption> tag must be placed directly after the <table> tag.

Note: Only one title can be specified for each table.

Hint: By default, the table title will be centered above the table. However, the CSS property text-align and caption-side can be used for alignment and placement of the title.

HTML 4.01 and HTML5Differences between

The align attribute has been removed from HTML5Removed from HTML.

Attribute

AttributeValueDescription
alignleft
right
top
bottom

HTML5 Not supported. HTML 4.01 Deprecated.    Define the alignment of the title.
It can be one of the following values:
left-Represents the title appearing in the table
top -Represents the title appearing in the table
right -Represents the title appearing in the table
bottom -Represents the title appearing below the table at the bottom

Global Attributes

Support for <caption> Tag Global Attributes of HTML.

Event Attributes

Support for <caption> Tag HTML Event Attributes.