css怎样设置 div平均分配满

html-css010

css怎样设置 div平均分配满,第1张

给两种方法:

第一种:百分比。使用均分的百分比宽度。

第二种:css3弹性布局。父级给定宽度display:flexflex-direction:row子元素全部设置flex:1;

<div style="background:redpadding:10pxwidth:100px"><div style="height:500pxwidth:100pxbackground:#ccc"></div></div>

你复制过去看看DIV 本来就是 高度、宽度随子DIV变化

你是不是设了 一些 FLOAT 属性?

那就要 float 元素结尾 加上

<div style=" clear:both"><div> 清楚浮动

最小高度 你试试这个

min-height:500px /*高度最小值设置为:100px*/

height:auto !important/*兼容FF,IE7也支持 !important标签*/

height:500px/*兼容ie6*/