Width
要素の幅を指定します。
●関連プロパティ
POSITION | TOP & BOTTOM | LIGHT & LEFT | HEIGHT
{ width : absolute size | percentage | auto }
数値で指定
要素の幅を、数値で指定します。
サンプルは、高さ80px幅300pxの親要素の<DIV>の中に、幅200pxの<DIV>を配置しました。 背景画像の罫線ピッチは、10pxです。
{ width : length in | length cm | length mm | length pt | length pc | length px }
<div style="position: relative; height: 80px; width: 300px;">
<div style="position: absolute; width: 200px; height:
auto;"><p>Width: 200px</p></div>
</div>
パーセントで指定
要素の幅を、パーセントで指定します。
サンプルは、高さ80px幅300pxの親要素の<DIV>の中に、幅50%の<DIV>を配置しました。 親の幅300pxですから、幅150pxになっています。
{ width : Percentage }
<div style="position: relative; height: 80px; width: 300px;">
<div style="position: absolute; width: 50%; height: auto;"><p>Width:
50%</p></div>
</div>
|
|
|
|---|