1,居中布局
<style>
.box{
width:400px;
margin:0 auto;
}
</style>
<body>
<div class="box">f</div>
</body>
方式2:
<style>
.box{
width:400px;
position:relative;
left:50%;
}
</style>
<body>
<div class="box">f</div>
</body>
2,浮动布局设计
<style>
#left{
width:400;
float:left;
height:300;
border:2px solid #66f
}
#right{
width:400;
float:left;
height:300;
border:2px solid #66f
}
</style>
<body>
<div id="left"></div>
<style>
.box{
width:400px;
margin:0 auto;
}
</style>
<body>
<div class="box">f</div>
</body>
方式2:
<style>
.box{
width:400px;
position:relative;
left:50%;
}
</style>
<body>
<div class="box">f</div>
</body>
2,浮动布局设计
<style>
#left{
width:400;
float:left;
height:300;
border:2px solid #66f
}
#right{
width:400;
float:left;
height:300;
border:2px solid #66f
}
</style>
<body>
<div id="left"></div>
<div id="right"></div>