我有一个网格容器,其中有3列和6个子项。当我将此容器的“ justify-content”属性设置为“ space-between”时,网格元素无法正确显示。在Firefox中,一切都很好,但是在Chrome中,行高似乎计算不正确,并且高度小于预期。 这是显示问题的代码:
.container {
background-color: #69D1C5;
display: grid;
grid-template-columns: repeat(3, minmax(auto, 200px));
justify-content: space-between;
gap: 10px
}
.container .item {
width: 100%;
background-color: #8980F5;
}
<div class="container">
<div class="item">
Spectacular ice age wolf pup and caribou dug up in Canada
</div>
<div class="item">
Plant roots evolved at least twice, and step by step
</div>
<div class="item">
Spectacular ice age wolf pup and caribou dug up in Canada Spectacular ice age wolf pup and caribou dug up in Canada
</div>
<div class="item">
Plant roots evolved at least twice, and step by step
</div>
<div class="item">
Plant roots evolved at least twice, and step by step Plant roots evolved at least twice, and step by step
</div>
<div class="item">
Plant roots evolved at least twice, and step by step
</div>
</div>
这是Codepen链接:link