
1、flex-grow指扩展flex子项所占据的宽度,扩展的空间就是除去元素外剩余的空白间隙。
2、不支持负值,默认值是0,表示不占用剩余的空白间隙扩展自己的宽度。
如果flex-grow大于0,则flex容器剩余空间的分配就会发生。
实例
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | // HTML部分
<div>
<div></div>
<div></div>
<div></div>
</div>
// CSS部分
.box{
width : 600px ;
height : 200px ;
border : 1px solid ;
display : flex;
}
.box div:nth-of-type( 1 ){
width : 100px ;
height : 100px ;
background-color : red ;
}
.box div:nth-of-type( 2 ){
width : 150px ;
height : 100px ;
background-color : skyblue;
}
.box div:nth-of-type( 3 ){
width : 200px ;
height : 100px ;
background-color : yellow;
}
|
以上就是css中flex-grow属性的介绍,希望对大家有所帮助。更多css学习指路:css教程
本文教程操作环境:windows7系统、css3版,DELL G3电脑。