ブロック要素を真ん中に配置
Web標準普及プロジェクト - ブロックレベル要素をセンタリングする方法
サンプル:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <style type="text/css"> <!-- div.parent { border: 1px solid #ee3333; margin: 5px; } div.child { border: 1px solid #33ee33; width:300px; } --> </style> </head> <body> <div style="text-align:center;" class="parent"> <div style="margin: 0 auto;" class="child"> 真ん中に表示したいブロック要素 </div> </div> <div class="parent"> <div style="margin: 0 auto;" class="child"> IEだと真ん中にならないブロック要素 </div> </div> <div style="text-align:center;" class="parent"> <div class="child"> FireFoxだと真ん中にならないブロック要素 </div> </div> </body> </html>