嗯,今天重新玩了下布局,把部分布局方式整理了一下,也就顺手记了下来。(都测试过了,IE6 +,FF,opera,chromer浏览器现在流行的版本都支持)
一、三列(固宽)
<div id="container">
<div id="sideBar"></div>
<div id="sideBarS"></div>
<div id="content"></div>
</div>
<div id="sideBar"></div>
<div id="sideBarS"></div>
<div id="content"></div>
</div>
#container{
margin: 0 auto;
width: 950px;
overflow: auto; /*在使用过程中,IE7有时候会出现问题,这时可把值改为“hidden”,清除浮动带来的问题*/
}
#sideBar,
#sideBarS{
float: left;
width: 250px;
height: 500px;
background-color:#0CF;
}
#sideBarS{
float: right!important;
}
#content{
margin: 0 260px!important;
margin: 0 257px; /*这里主要是为了应付IE6*/
height: 500px;
background-color:#06F
}
margin: 0 auto;
width: 950px;
overflow: auto; /*在使用过程中,IE7有时候会出现问题,这时可把值改为“hidden”,清除浮动带来的问题*/
}
#sideBar,
#sideBarS{
float: left;
width: 250px;
height: 500px;
background-color:#0CF;
}
#sideBarS{
float: right!important;
}
#content{
margin: 0 260px!important;
margin: 0 257px; /*这里主要是为了应付IE6*/
height: 500px;
background-color:#06F
}
二、单行单列(高宽均100%)
嗯,这种情况不算少用,特别是弹出的DIV块时就用到了
<div id="container"></div>
html,body{
padding: 0;
margin: 0;
height: 100%;
}
#container{
width: 100%;
height: 100%;
background-color:#06C;
}
padding: 0;
margin: 0;
height: 100%;
}
#container{
width: 100%;
height: 100%;
background-color:#06C;
}