gpt4 book ai didi

css - 在 css 中创建盒子模型

转载 作者:行者123 更新时间:2023-11-27 23:25:48 25 4
gpt4 key购买 nike

我需要一点帮助。

我想创建如图所示的盒子模型,有人可以帮我吗。

我已经写好了代码,但我不知道如何做才能更好。

image

.container {
display: flex;
justify-content: flex-start;
flex-direction: row;
flex-wrap: wrap;
}

.card {
background: #cecdcd;
color: #000;
position: relative;
width: 110px;
height: 110px;
margin: 10px;
overflow: hidden;
word-wrap: break-word;
border-radius: 10px;
transition: 200ms;
}
<div class="container">
<div class="card">
</div>
<div class="card">
</div>
<div class="card">
</div>
<div class="card">
</div>
<div class="card">
</div>
<div class="card">
</div>
<div class="card">
</div>
<div class="card">
</div>
<div class="card">
</div>
<div class="card">
</div>
<div class="card">
</div>
</div>

最佳答案

是这样的吗? https://codepen.io/hisbvdis/pen/rNBYyJy

.container {
display: flex;
justify-content: flex-start;
flex-direction: row;
flex-wrap: wrap;
max-width: 900px;
margin: 0 auto;
border: 1px solid #000;
}

.card {
flex-basis: calc((100% - 60px) / 3);
background: #cecdcd;
color: #000;
position: relative;
/* width: 110px; */
height: 110px;
margin: 10px;
overflow: hidden;
word-wrap: break-word;
border-radius: 10px;
transition: 200ms;
}
<div class="container">
<div class="card">
</div>
<div class="card">
</div>
<div class="card">
</div>
<div class="card">
</div>
<div class="card">
</div>
<div class="card">
</div>
<div class="card">
</div>
<div class="card">
</div>
<div class="card">
</div>
<div class="card">
</div>
<div class="card">
</div>
</div>

关于css - 在 css 中创建盒子模型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57785929/

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