表の大きさを指定する

[新着] Webテンプレートを仮オープンしました


width: ***; height: ***;

ブラウザ
Internet Explorer Netscape6 Firefox Opera
参考
書式基本 要素名 クラス ID

width は横幅、height は高さを指定するプロパティです。

table要素にこのスタイルを設定すると、表の大きさを指定することができます。


table {
width: 300px;
height: 200px;
}


width 表の横幅を指定します
height 表の高さを指定します

それぞれ 数値+単位(px、他)か %(割合)で指定します。

※デフォルトは auto(自動)です。(例:width: auto


使用例

<html>
<head>
<title>TAG index Webサイト</title>

<style type="text/css">
<!--

table {
border: 2px #2b2b2b solid;
width: 400px;
height: 200px;
}


td, th {
border: 2px #2b2b2b solid;
}


-->
</style>

</head>
<body>

<table>
<tr>
<th>サーバー</th>
<th>Web作成</th>
</tr>
<tr>
<td>サーバーA社</td>
<td>Web作成A社</td>
</tr>
</table>

</body>
</html>

これをブラウザで見ると次のように表示されます

サーバー Web作成
サーバーA社 Web作成A社


[特集] レンタルサーバー比較 & サーバー選びのチェックポイント

サイト内検索について - ベーシック版