如何将div块移动到a)中心和b),对吗?也就是说,我希望将innerWrap及其内容移到中间或右边。

.smallW {
width: 10%;
height: 100px;
background-color: green;
float: left;
}
.largeW {
width: 50%;
height: 100px;
background-color: blue;
float: left;
}
.outerWrap {
position: relative;
}
.innerWrap {
background-color: yellow;
width: 100%;
}<div class="outerWrap">
<div class="innerWrap">
<div class="smallW"></div>
<div class="largeW"></div>
<div class="smallW"></div>
</div>
</div>
发布于 2019-06-07 05:37:12
.smallW {
flex-basis: 10%;
background-color: green;
}
.largeW {
flex-basis: 50%;
background-color:blue;
}
.innerWrap {
background-color:yellow;
display:flex;
justify-content:flex-end;
height:100px;
}<div class="outerWrap">
<div class="innerWrap">
<div class="smallW"></div>
<div class="largeW"></div>
<div class="smallW"></div>
</div>
</div>
使用Flex而不是float。
https://stackoverflow.com/questions/56488383
复制相似问题