メインメニュー


[スポンサードリンク]


テーブルにタイトルを付ける
caption-side:タイトルの位置

タイトルの位置:
top 上に表示
bottom 下に表示

caption-sideプロパティで、テーブルのタイトルの位置を指定します。
テーブル自体はHTMLのタグ(caption要素)を使用して作成し、そのタグに対してcaption-sideプロパティで表示させる位置を指定してやります。
しかしこのプロパティはNetscape6以降のみしか対応しておらず、InternetExplorerでは上手く表示されないようです。


テーブルの上にタイトルを付ける
名前 郵便番号 都道府県
愛うえ雄 123-0000 東京都
柿くけ子 456-0000 北海道



テーブルの下にタイトルを付ける
名前 郵便番号 都道府県
愛うえ雄 123-0000 東京都
柿くけ子 456-0000 北海道

<STYLE type="text/css">
<!--
CAPTION { font-size:11pt; }
TH { font-size:9pt; }
CAPTION#case1 { caption-side : top ; }
CAPTION#case2 { caption-side : bottom ; }
-->
</STYLE>

<TABLE cellpadding="0" cellspacing="5" border="1" bgcolor="#edfbed">
<CAPTION id="case1">テーブルの上にタイトルを付ける</CAPTION>
<TR>
<TH width="100">名前</TH>
<TH width="100">郵便番号</TH>
<TH width="100">都道府県</TH>
</TR>
<TR>
<TD width="100" align="center">愛うえ雄</TD>
<TD width="100" align="center">123-0000</TD>
<TD width="100" align="center">東京都</TD>
</TR>
<TR>
<TD width="100" align="center">柿くけ子</TD>
<TD width="100" align="center">456-0000</TD>
<TD width="100" align="center">北海道</TD>
</TR>
</TABLE>

<BR><HR><BR>

<TABLE cellpadding="0" cellspacing="5" border="1" bgcolor="#e5e4f9">
<CAPTION id="case2">テーブルの下にタイトルを付ける</CAPTION>
<TR>
<TH width="100">名前</TH>
<TH width="100">郵便番号</TH>
<TH width="100">都道府県</TH>
</TR>
<TR>
<TD width="100" align="center">愛うえ雄</TD>
<TD width="100" align="center">123-0000</TD>
<TD width="100" align="center">東京都</TD>
</TR>
<TR>
<TD width="100" align="center">柿くけ子</TD>
<TD width="100" align="center">456-0000</TD>
<TD width="100" align="center">北海道</TD>
</TR>
</TABLE>