サイト内検索

...スタイルシート(css)...

スタイルシート・table

セル内のサイズ

セルのサイズ
横幅には、widthプロパティを指定します。
高さには、heightプロパティを指定します。
[使い方]
th,td{
width: 80%;
height: 150px;
}
プロパティ名 説明
width: ;横幅を指定します。
「数値+単位」(例・・100px)を指定します。
単位は、「px」・「em」など、または「%」を指定します。
auto; 初期値(内容により自動調整)
height: ; 高さを指定します。
「数値+単位」(例・・100px)を指定します。
単位は、「px」・「em」など、または「%」を指定します。
auto; 初期値(内容により自動調整)

サンプル

[headの中]

<style type="text/css">
<!--
table{
width: 380;
height: 150px;
border: 1px #999999 solid;
border-collapse: separate;
}
th.sam1, td.sam1{
width: 30%;
border: 1px #999999 solid;
}
th.sam2, td.sam2{
width: 70%;
border: 1px #999999 solid;
}
-->
</style>

[bodyの中]

<table>
<tr>
<th class="sam1">No</th>
<th class="sam2">No</th>
</tr>
<tr>
<td id="sam3">width: 100px; </td>
<td id="sam3">width: 200px; </td>
</tr>
</table>

[ブラウザ上]

NoNo
width: 100px;width: 200px;

Copyright c 2007.10.01 luc All rights reserved.