我想知道为什么我的容器 div 向右对齐
[code][1]
看起来有一个边距将容器推向右侧,但是显然,是有的。我很困惑。请帮助
我的代码附在下面
.stat {
background-color: white;
border-radius: 12px;
margin: 3rem;
}
.container {
margin-top: 8rem;
display: grid;
grid-template-columns: 1fr 1fr 1fr;
}
.statistic {
background-color: #F2F2F2;
margin: 1rem;
padding: 1rem 8rem;
border-radius: 12px;
font-size: small;
justify-self: center;
}
<div class="stat">
<div class="container">
<div class="stat1 statistic">
<span>86K</span> Students
</div>
<div class="stat2 statistic">
<span>142</span> Tutors
</div>
<div class="stat3 statistic">
<span>900</span> Courses
</div>
</div>
</div>
[code][1]
It looks like there is a margin pushing the container to the right but clearly, there is. I'm confused. Please help
My code is attached below
.stat {
background-color: white;
border-radius: 12px;
margin: 3rem;
}
.container {
margin-top: 8rem;
display: grid;
grid-template-columns: 1fr 1fr 1fr;
}
.statistic {
background-color: #F2F2F2;
margin: 1rem;
padding: 1rem 8rem;
border-radius: 12px;
font-size: small;
justify-self: center;
}
<div class="stat">
<div class="container">
<div class="stat1 statistic">
<span>86K</span> Students
</div>
<div class="stat2 statistic">
<span>142</span> Tutors
</div>
<div class="stat3 statistic">
<span>900</span> Courses
</div>
</div>
</div>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
用它来居中你的 div
Use this to center your div