
第一种:

第二种

弹性布局

父标签中使用display:flex
如果使用弹性布局,则子元素不需要设置float即浮动但是就会有浮动的效果
justify-content:space-around

justify-content:space-between


justify-content:center 水平居中


align-items:center 垂直居中


flex-direction:row 默认的



纵向排列


多行时 即元素所占的大于一行时,想不要中间的间隙
align-content:center


子元素设置:


flex-grow:1 作用:定义子元素放大比例


align-self: 其实就是用来覆盖父级align-ltems 垂直排列





来源:https://blog.csdn.net/jjw_zyfx/article/details/100751749