gpt4 book ai didi

html - 2 div 在另一个 div 内但在文本之下

转载 作者:可可西里 更新时间:2023-11-01 13:03:17 25 4
gpt4 key购买 nike

我有一个内容 div,里面有一些文本,内容 div 中有 2 个 div 并排放置。

我希望 2 个子 div 并排显示,但在文本下方,而不是在文本旁边。

body {
text-align: center;
}
#first, #second {
border: solid green 2px;
}
#content {
border: solid purple 2px;
display: flex;
clear: both;
}
#second {
background-color: yellow;
padding-bottom: 500px;
width: 100px;
display: inline;
position: relative;
}
#first {
background-color: palegoldenrod;
padding-bottom: 500px;
width: 400px;
display: inline;
position: relative;
}
<div id="content">div id="content"
<div id="second">div id="second"</div>
<div id="first">div id="first"</div>
</div>

这是一个 Jsfiddle现在的样子。

最佳答案

查看更新的 JSFiddle

#first, #second {
border: solid green 2px;
}
#content {
border: solid purple 2px;
clear: both;
}
#second {
background-color: yellow;
padding-bottom: 500px;
width: 100px;
position: relative;
float: right;
}
#first {
background-color: palegoldenrod;
padding-bottom: 500px;
width: 400px;
position: relative;
float: left;
}

#content::after {
content: "";
clear: both;
display: block;
}

Demo

关于html - 2 div 在另一个 div 内但在文本之下,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36494503/

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