gpt4 book ai didi

html - 如何将一个容器分成多行,每行有不同的列

转载 作者:太空宇宙 更新时间:2023-11-04 13:33:57 25 4
gpt4 key购买 nike

我想将一个容器分成 3 行。其中第一行有 2 列(并排显示 2 个元素)。

第二行有 3 列,第三列再次分成两列,比如 23a 和 23b。 23b 再次有 2 行。

第三行有 2 列(与第一行类似。)

这是我的父容器:

.container
{
position:fixed;
margin-top:-325px;
width:75%;
height:75px;
background-color:#300000;

}

我尝试了多种组合。但没有成功实现我想要的。有人可以帮帮我吗?

谢谢

最佳答案

这是您所描述内容的一部分:http://jsfiddle.net/fvGMb/

您需要让行具有设定的宽度,然后您可以让这些行中的列具有描述您希望的宽度的百分比。列需要 float 。

CSS

.col {
float: left;
}
.row {
width: 100%;
}
.half {
width: 50%;
}
.third {
width: 33.33%;
}

HTML

<div class="row">
<div class="col half">
</div>
<div class="col half">
</div>
</div>
<div class="row">
<div class="col third">
</div>
<div class="col third">
</div>
<div class="col third">
<div class="col half">
</div>
<div class="col half">
</div>
</div>
</div>

关于html - 如何将一个容器分成多行,每行有不同的列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23178774/

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