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

HTML リファレンスマニュアル

HTML タグ一覧

HTML caption align 属性

align属性は字幕要素のアライメント方法を定義します。この属性は、タイトルをブロック要素としてテーブルの左側、右側、上側、または下側にアライメントする必要があります。

HTML <caption> タグ

オンラインサンプル

左側、右側、下部、上部に並べた<caption>要素を持つテーブル:

!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>HTML <caption> align 属性の使用-基本チュートリアル(oldtoolbag.com)</title>
<style>
table, th, td {
  border: 1px solid black;
}
</style>
</head>
<body>
<p>align="left":</p>
<table>
  <caption align="left">My savings</caption>
  <tr>
    <th>月</th>
    <th>Savings</th>
  </tr>
  <tr>
    <td>January</td>
    <td>$100</td>
  </tr>
</table>
<p>align="right":</p>
<table>
  <caption align="right">My savings</caption>
  <tr>
    <th>月</th>
    <th>Savings</th>
  </tr>
  <tr>
    <td>January</td>
    <td>$100</td>
  </tr>
</table>
<p>align="top":</p>
<table>
  <caption align="top">My savings</caption>
  <tr>
    <th>月</th>
    <th>Savings</th>
  </tr>
  <tr>
    <td>January</td>
    <td>$100</td>
  </tr>
</table>
<p>align="bottom":</p>
<table>
  <caption align="bottom">My savings</caption>
  <tr>
    <th>月</th>
    <th>Savings</th>
  </tr>
  <tr>
    <td>January</td>
    <td>$100</td>
  </tr>
</table>
</body>
</html>
テストを見てみる ‹/›

ブラウザの互換性

IEFirefoxOperaChromeSafari

すべての主要ブラウザは align 属性をサポートしています。

注意:

  • Internet Explorer 8 「left」、「right」、「top」および「bottom」をサポートしています。 値

  • Internet Explorer 9+ 「top」および「bottom」の値をサポートしています。

  • Firefox は「left」、「right」、「top」および「bottom」の値をサポートしています。

  • Opera は「left」、「right」、「top」および「bottom」の値をサポートしています。

  • Chrome は「top」および「bottom」の値をサポートしています。

  • Safari は「top」および「bottom」の値をサポートしています。

定義と用法

HTML5 <caption>のalign属性はサポートされていません。代わりにCSSを使用してください。

<caption>のalign属性はHTMLで 4.01 既に廃止されています。

align属性はcaption要素の整列方法を指定します。

この属性はcaptionをテーブルの左、右、上、下にブロック要素として整列します。

互換性のコメント

THTML5 <caption>のalign属性はサポートされていません。代わりにCSSを使用してください。

CSS 文法: <caption style="caption-side:bottom">または<caption style="text-align:left">

CSS 例:テーブルのタイトルの位置

私たちの CSS 教程では、以下についてさらに詳しく学ぶことができます。caption-side 属性の詳細。

文法

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

属性値

説明
leftタイトルはテーブルの左にあります。
rightタイトルはテーブルの右にあります。
topタイトルはテーブルの上にあります。
bottomタイトルはテーブルの下にあります。

HTML <caption> タグ