サイト内検索
...HTML・XHTMLタグ...
table
テキストの位置の指定(回り込み)
- 表の配置とその後に続くテキストの揃え方は、table要素にalign属性を指定します。
- [使い方]
- <table align="center">
- [メモ・・・W3Cの検証サービス・・・]
- HTML 4.01 Strict ・ XHTML1.0 Strictでは、推奨されていませんので、
- Validするには、スタイルシートを使用します。
- float(左右の位置)プロパティ・marginプロパティ指定します。
- [サンプル]
- .sample{float: left; margin-left: auto;}
属性 | 属性値 | 説明 |
---|---|---|
align= | "left" | 表の右側にテキストを表示します。 |
"center" | 表を中央に表示します。 | |
"right" | 表の左側にテキストを表示します。 |
サンプル
《align="left" の場合》
[bodyの中]
<table border="1" align="left" width="150" height="70"><tr>
<th>No1</th>
<th>No2</th>
</tr>
<tr>
<td>No3</td>
<td>No4</td>
</tr>
</table>
align="left"
を設定
しています
float・marginを指定
[bodyの中]
<table border="1"style="float:left; margin-right:50px; height: 70px;" width="150">
<tr>
<th>No1</th>
<th>No2</th>
</tr>
<tr>
<td>No3</td>
<td>No4</td>
</tr>
</table>
float:left; margin-left:auto;
を
指定しています
[ブラウザ上]
No1 | No2 |
---|---|
No3 | No4 |
を
指定しています