[新着] Webテンプレートを仮オープンしました
table-layout は、表の表示方法を指定するプロパティです。
このスタイルはtable要素に適用できます。
table {
width: 300px;
table-layout: fixed;
}
| table-layout | auto … (自動レイアウトを指定します)デフォルト |
|---|---|
| fixed … (固定レイアウトを指定します) |
■自動レイアウト(auto)
表全体のデータを読み込んでから表示を開始します。
■固定レイアウト(fixed)
1行目を読み込んだ時点でレイアウト(各セル幅のサイズ)を決定し、すぐに表示を開始します。
<html>
<head>
<title>TAG index Webサイト</title>
<style type="text/css">
<!--
table {
border: 2px #2b2b2b solid;
width: 400px;
table-layout: fixed;
}
td, th {
border: 2px #2b2b2b solid;
width: 50%;
}
-->
</style>
</head>
<body>
<table>
<tr>
<th>ホスティング</th>
<th>ホームページ制作</th>
</tr>
<tr>
<td>サーバーA社</td>
<td>WebデザインA社</td>
</tr>
</table>
</body>
</html>
▼これをブラウザで見ると次のように表示されます
| ホスティング | ホームページ制作 |
|---|---|
| サーバーA社 | WebデザインA社 |