Style captionSideプロパティ

Style 对象参考手册Style オブジェクト

定義と使い方

captionSide プロパティは、テーブルのキャプションの位置を設定または返します。

構文

captionSide プロパティを設定:

Object.style.captionSide="top|bottom|inherit"

captionSide プロパティを返す:

Object.style.captionSide

值 説明
top デフォルト。テーブルのキャプションをテーブルの上に配置します。
bottom テーブルのキャプションをテーブルの下に配置します。
inherit captionSide プロパティの値は親要素から継承されます。


ブラウザーのサポート

Internet ExplorerFirefoxOperaGoogle ChromeSafari

すべての主要ブラウザーは captionSide プロパティをサポートしています。

注意:IE7 以前のバージョンは captionSide プロパティをサポートしていません。IE8 は !DOCTYPE が指定されている場合のみ captionSide プロパティをサポートします。IE9 は captionSide プロパティをサポートしています。


例

例

テーブルのキャプションをテーブルの下部に移動:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>サンプル(example.com)</title>
<script>
function displayResult(){
    document.getElementById("myCap").style.captionSide="bottom";
}
</script>
</head>
<body>

<table border="1">
<caption id="myCap">My savings</caption>
    <tr>
        <th>Month</th>
        <th>Savings</th>
    </tr>
    <tr>
        <td>January</td>
        <td>$100</td>
    </tr>
    <tr>
        <td>February</td>
        <td>$150</td>
    </tr>
</table>
<br>
<button type="button" onclick="displayResult()">移动表格标题</button>

</body>
</html>

試してみる »


Style 对象参考手册Style オブジェクト その他の拡張