gpt4 book ai didi

html - 显示 9x9 div/grid css

转载 作者:行者123 更新时间:2023-12-04 09:29:29 27 4
gpt4 key购买 nike

我正在尝试使用以下 css 制作一个 9x9 div,但如果我显示 4 个 div,如下图所示,它会崩溃
enter image description here
这是我的 css

.grid {
display: flex;
flex-wrap: wrap;
justify-content: space-around;
}
.cell {
flex: 0 0 33%;
height: 100px;
width: 100px;
margin-bottom: 5px;
}
<div class="grid">
<div class="cell" style="background-color: green">1</div>
<div class="cell" style="background-color: red">1</div>
<div class="cell" style="background-color: blue">1</div>
<div class="cell" style="background-color: yellow">1</div>
</div>

我想要的输出是一个 css,它允许我的网格显示以下内容
enter image description here

最佳答案

尝试

justify-content : flex-start;
反而。这使子元素从每一行的左侧开始打包。

关于html - 显示 9x9 div/grid css,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62904974/

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