.main {width:1000px;margin:0 auto;}.left {width:245px;float:left;}.center {width:435px;float:left;margin-left:10...
CSS控制DIV宽度代码:
<div class="main"><div class="left"></div><div class="center"></div><div class="right"></div><div class="cle"></div></div><style type="text/css">.main {width:1000px;margin:0 auto;}.left {width:245px;float:left;}.center {width:435px;float:left;margin-left:10px;}.right {width:300px;float:right;}.cle {height:0;clear:both;}</style> 正常情况中间是要定宽度的,特殊手段还是做到不定宽度的,注意:center、left和right的总宽度+他们的margin不能大于main的宽度。2013-09-08
<div class="div-left"></div>
<div class="div-center"></div>
<div class="div-right"></div>
CSS如下:
.div-left { width: 150px; }
.div-right { width: 300px; }
.div-center { width: 530px }
中间的DIV必须设定宽度,否则不同的宽度的显示器会导致页面下坠。2013-09-08