margin

書式 margin:間隔
対象全ての要素
継承しない
初期値 0
解説
ボックスの余白を指定します。パラメータの数により余白の設定される場所が変わります。
設定するパラメータ数設定内容
1上下左右に同じ間隔を設定する
2上下、左右の順番で間隔を設定する
3上、左右、下の順番で間隔を設定する
4上右下左の順番で間隔を設定する
サンプルコード
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>Sample</title>
<style type="text/css"><!--
body { margin:0px; }
div { position:absolute; left:10px; top:10px;width:300px;height:100px;
border:1px black solid;
margin:10px 0px 0px 20px;
}
--></style>
</head>
<body>
<img src="Default.png">
<div>Dashboard<br>Sample Text</div>
</body>
</html>
</html>
実際のサンプルをダウンロード