30分如何定义多个DIV嵌套居中

来源:百度知道 编辑:UC知道 时间:2024/05/26 18:27:35

先定义一个DIV,在里面有二个或多个DIV,怎么居中排列.
假如,里面有四个,按二行二列,怎么居中,?

望高手简写代码,,详细更好30分.
感谢各位,两个都可用LEFT,RIGHT固定,但如果一个DIV中有6个怎么分两排三列居中???

是不是一个田字啊,我只这样理解的,没写过div
<body >

<div style="text-align:center">
<div style="width:800px; height:400px; background-color:#0099CC">
<div style="width:400px; height:400px; background-color:#AAAACC; position:absolute">
</div>
</div>

<div style="width:800px; height:400px; background-color:#11aaBB">
<div style="width:400px; height:400px; background-color:#ffAACC; position:absolute">
</div>
</div>
</div>
</body>

加两个div
<style type="text/css">
* {
margin:0;
padding:0;
}
#main {

}
#main2 {
margin:auto;
background:red;
width:600px;
}
#main3 {
clear:both;
margin:auto;
background:blue;
width:500px;
}
#