適当センター寄せ
question:1115324003
一応サンプルを作ってみたものの弄るのが面倒臭くなったので止めた。
サイズの調整が必要になるが出来ることは出来る。
全体の幅に難があって、.centerbodyのサイズは760pxがお勧めなようだ。どうも。
元がwidthを800*600用に決め打ちなので設定は楽。数字を上手く弄った方がいいと思うのだが、そこは手を抜いているのだろうか、微妙にグリッドからずれていて気持ち悪い。
で、元のサイトを適当に直して書く。
html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <body> <div class="centerbody"> <div class="top"> <img width="760" height="90"> </div> <div class="menu"> <img> <a href=""#">menu1</a><br> </div> <div class="center"> mainの文章つぅか広告. </div> <div class="pr"> <img> etc </div> </div> </body>
CSS
body { text-align: center; /* for IE quirk */ } div.centerbody { width: 760px; margin: 0px auto; text-align: left; position: relative; top: 0px; left: 0px; } .menu { width: 140px; position: absolute; top: 100px; left: 0px; } .center { width: 400px; position: absolute; top: 100px; left: 150px; } .pr { width: 200px; position: absolute; top: 100px; left: 560px; }