センタリングする

margin-left: auto; margin-right: auto
margin: auto

margin:
上下マージン auto
margin:
上マージン auto 下マージン

*上下マージン、上マージン、下マージンに付いては任意の値

これらの用法は、ブロックレベル要素のボックスをセンタリングさせる指定です。
左右のマージンの値を「auto」に設定するとセンタリングされますので、上の書式の
どれを使用してもセンタリングは可能です。ブロックレベル要素の内容の行揃えを設定
したい場合には、text-align プロパティを使用して下さい。
なお、Windows版のInternetExplorer6.0の場合は、標準モードでなければセンタリングされません。

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
<META http-equiv="Content-Style-Type" content="text/css">
<TITLE>CSS覚書</TITLE>
<STYLE type="text/css">
<!--
body {
color: #ff6600;
background: #ffffff
}
h2,p {
margin-left: auto;
margin-right: auto;

padding: 20px;
width: 150px;
}
table {
margin: auto
}
h2,p ,table {
color: #ffffff;
background: #ff6600
}
h1 {
text-align: center;
color: #ff6600
}
-->
</STYLE>
</herd></HEAD>
<body>
<h1>センタリングする</h1>
<center>
<H2 align="left">これはh2要素です</H2>
<P align="left">これはp要素です</P>
<DIV>
<table border="3" cellpadding="6">

<tr>
<th>ヘッダ</th>
<th>ヘッダ</th>
<th>ヘッダ</th>
</tr>
<tr>
<td>データ</td>
<td>データ</td>
<td>データ</td>
</tr>

</table>
</DIV>
</center>
</body>
</html>