display

書式

display:種類

対象

全ての要素

継承

しない

初期値

block

バージョン

CSS Level 1

対応ブラウザ

Win IE4.0以降, Mac IE5.0, NN6.0以降, Firefox, Opera 6, Safari

解説

要素の種類を指定します。以下のものが指定できます。
設定名内容
noneなし
blockブロックレベル要素
inlineインラインレベル要素
list-itemリスト
markerリストマーカー
run-inブロックレベル要素。ただし、以後に続くのがブロックレベル要素の場合、ブロックレベル要素をインラインレベル要素の先頭に表示する(float, positionで位置指定していない場合)
tableテーブル/表(ブロックレベル要素)
inline-tableテーブル/表(インラインレベル要素)
table-rowテーブル/表の行(tr)
table-row-groupテーブル/表の行(tbody)
table-header-groupテーブル/表の行グループ(thead)
table-columnテーブル/表の列(col)
table-column-groupテーブル/表の列グループ(colgroup)
table-captionテーブル/表のキャプション(caption)
table-cellテーブル/表のセル(th,td)
サンプルコード
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>Sample</title>
<style type="text/css"><!--
body { margin:0px; }
.box1 { position:absolute;border:1px black solid;
left:10px;
top:10px;
width:300px;
height:100px;
}
.box2 { position:absolute;border:1px black solid;background-color:gray;
left:40px;
top:40px;
width:300px;
height:100px;
display:none;
}
--></style>
</head>
<body>
<div class="box1">CSS Sample Text</div>
<div class="box2">CSS Sample Text</div>
</body>
</html>
実際のサンプルを実行する