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

HTML-Referenzhandbuch

HTML-Tag-Übersicht

HTML caption align 属性

HTML caption align Attribut

HTML <caption> Tag

Align-Attribut definiert die Ausrichtung des Caption-Elements. Dieses Attribut sollte den Titel als Block-Element auf die linke, rechte, obere oder untere Seite der Tabelle ausrichten.

Online-Beispiel

Beispiel
<!DOCTYPE html>
<html>
<head>-8<meta charset="utf
">-<title>HTML <caption> align Attribut verwenden</title>3codebox.com)</title>/title>
<style>
table, th, td {
  Rahmen: 1px fest schwarz;
}
</style>
</head>
<body>
<p>align="left":</p>
<table>
  <caption align="left">Meine Ersparnisse</caption>
  <tr>
    <th>Monat</th>
    <th>Ersparnisse</th>
  </tr>
  <tr>
    <td>January</td>
    <td>$100</td>
  </tr>
</table>
<p>align="right":</p>
<table>
  <caption align="right">Meine Ersparnisse</caption>
  <tr>
    <th>Monat</th>
    <th>Ersparnisse</th>
  </tr>
  <tr>
    <td>January</td>
    <td>$100</td>
  </tr>
</table>
<p>align="top":</p>
<table>
  <caption align="top">Meine Ersparnisse</caption>
  <tr>
    <th>Monat</th>
    <th>Ersparnisse</th>
  </tr>
  <tr>
    <td>January</td>
    <td>$100</td>
  </tr>
</table>
<p>align="bottom":</p>
<table>
  <caption align="bottom">Meine Ersparnisse</caption>
  <tr>
    <th>Monat</th>
    <th>Ersparnisse</th>
  </tr>
  <tr>
    <td>January</td>
    <td>$100</td>
  </tr>
</table>
</body>
</html>
Testen Sie es heraus ‹/›

Browserkompatibilität

IEFirefoxOperaChromeSafari

Alle gängigen Browser unterstützen das Attribut align.

Hinweis:

  • Internet Explorer 8 Die Werte "left", "right", "top" und "bottom" werden unterstützt. Werte.

  • Internet Explorer 9+ Die Werte "top" und "bottom" werden unterstützt.

  • Firefox unterstützt die Werte "left", "right", "top" und "bottom".

  • Opera unterstützt die Werte "left", "right", "top" und "bottom".

  • Chrome unterstützt die Werte "top" und "bottom".

  • Safari unterstützt die Werte "top" und "bottom".

定义和用法

HTML5 The <caption> align attribute is not supported. Please use CSS instead.

The align attribute of <caption> in HTML 4.01 is deprecated.

The align attribute specifies the alignment of the caption element.

This attribute aligns the caption as a block element to the left, right, top, or bottom of the table.

Compatibility Notes

THTML5 The <caption> align attribute is not supported. Please use CSS instead.

CSS Syntax: <caption style="caption-side:bottom"> or <caption style="text-align:left">

CSS Example: Positioning Table Titles

In our CSS tutorial, you can find more aboutcaption-side Details of the attribute.

Syntax

<caption align="left|right|top|bottom">

Attribute Value

ValueDescription
leftThe title is on the left side of the table.
rightThe title is on the right side of the table.
topThe title is above the table.
bottomThe title is below the table.

HTML <caption> Tag