CSS | IE/Edge | Firefox | Chrome | Opera | Safari |
---|---|---|---|---|---|
CSS1 | 3.0 | 1.0 | 1.0 | 3.5 | 1.0 |
要素の横幅を指定します。
値 | 説明 |
---|---|
<length> | 横幅を 100px や 10em のような長さの単位で指定します。 |
<percentage> | 横幅を 80% のようなパーセントで指定します。 |
auto | 横幅を自動計算します。 |
.sample { height: 100px; width: 100px; border: 1px solid gray; background-color: #cc9999; margin: 1em; }
<div class="sample"></div>