gpt4 book ai didi

html - 如何在css中将一个div分成多行和多列?

转载 作者:搜寻专家 更新时间:2023-10-31 22:02:30 24 4
gpt4 key购买 nike

我在 maindiv 中有一个 div subdiv。我想将子 div 分成多行和多列,如下所示。

如何划分subdiv如下

enter image description here

最佳答案

你可以这样做

div{
display:inline-block;
float:left;
color:#fff;
font-size:40px;
}

.one{
width:150px;
height:200px;
background:red;
}

.two{
width:100px;
height:200px;
background:lightgreen;
}

.three{
width:100px;
height:200px;
}

.four{
width:100px;
height:100px;
background:darkblue;
}
.five{
width:100px;
height:100px;
background:blue;
}
<div class="one">1</div>
<div class="two">2</div>
<div class="three">
<div class="four">4</div>
<div class="five">5</div>
</div>

关于html - 如何在css中将一个div分成多行和多列?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29427834/

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