td {
width: 100px;
height: 50px;
}
プロパティ名 |
値 |
説明 |
width |
数値+単位(px 等)またはパーセント |
セルの横幅を指定 (初期値は auto ) |
height |
数値+単位(px 等)またはパーセント |
セルの高さを指定 (初期値は auto ) |
使用例
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>文書のタイトル</title>
<style type="text/css">
table, td, th {
border: 2px #2b2b2b solid;
}
th.example1 { width: 100px; }
th.example2 { width: 200px; }
td { height: 100px; }
</style>
</head>
<body>
<table>
<tr>
<th class="example1">見出し1</th>
<th class="example2">見出し2</th>
</tr>
<tr>
<td>データ1</td>
<td>データ2</td>
</tr>
</table>
</body>
</html>
- 表示例
-