网站多久会被百度收录,网络营销网站建设流程,公司网站建设情况说明,大型网站建设方案常见问题要生成的效果图如下#xff1a; display:flexflex-direction: row;flex-wrap: wrap;当我们使用弹性盒子布局后#xff0c;默认元素是没有外边距的#xff0c;紧挨着样式就有点丑#xff0c;如果想使换行后#xff0c;元素的外边距有个距离#xff0c;可以用如下方法解决…要生成的效果图如下 display:flexflex-direction: row;flex-wrap: wrap;当我们使用弹性盒子布局后默认元素是没有外边距的紧挨着样式就有点丑如果想使换行后元素的外边距有个距离可以用如下方法解决
解决办法 1.父元素定高的情况下直接使用 align-content: space-between; ul{list-style: none;display: flex;height: 614px;flex-direction: row;flex-wrap: wrap;justify-content: space-between;align-content: space-between;}ul li{width: 234px;height: 300px;background-color: rgb(255, 2, 192);}2.父元素不定高的情况下 1设置需要更改间距的元素li的margin-bottom:14px,然后用父容器ul的margin-bottom: -14px;来抵消。 ul{list-style: none;display: flex;flex-direction: row;flex-wrap: wrap;margin-bottom: -14px;justify-content: space-between;align-content: space-between;}li{margin-bottom: 14px;}ul li{display: flex;width: 234px;height: 300px;background-color: rgb(255, 2, 192);}2 设置需要更改间距的元素li的margin-bottom14px;然后使用结构伪类选择器设置最后的几个元素margin-bottom: 0 ; ul{list-style: none;display: flex;flex-direction: row;flex-wrap: wrap;justify-content: space-between;align-content: space-between;}li{margin-bottom: 14px;}li:nth-child(n5){margin-top: 0;}ul li{display: flex;width: 234px;height: 300px;background-color: rgb(255, 2, 192);}