gpt4 book ai didi

html - 删除内联 block 元素中的默认边距?

转载 作者:行者123 更新时间:2023-11-28 16:24:48 26 4
gpt4 key购买 nike

代码:

<div style={{margin:'20px auto 20px auto', textAlign: 'center'}}>
{this.state.boxes.map((item,index) => {
return (<div
key={index}
style={{display: 'inline-block',boxSizing:'borderBox', border: "solid #333 1px", height: '130px', width: '130px', position: 'relative'}} > </div>)
})}
</div>

但是正如您所见,顶部和底部中间有一点空间? enter image description here

最佳答案

你要这样吗

.outer{
margin:20px auto 20px auto;
text-align: center;
height: 260px;
}
.inner{
display: inline-block;
border: solid #333 1px;
height: 50%;
width: 33.33%;
box-sizing : border-box;
position: relative;
}
.pull-left{
float:left;
}
<div class="outer">
<div class="inner pull-left"></div>
<div class="inner pull-left"></div>
<div class="inner pull-left"></div>
<div class="inner pull-left"></div>
<div class="inner pull-left"></div>
<div class="inner pull-left"></div>
</div>

关于html - 删除内联 block 元素中的默认边距?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46341366/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com