gpt4 book ai didi

css - 包含 3 个 div 到 3 列

转载 作者:行者123 更新时间:2023-11-28 15:13:29 25 4
gpt4 key购买 nike

所以我试图将三个 div 并排设置为三列。现在每个 div 的宽度都溢出了,我想对其进行设置,以便内容(文本)在达到 div 的长度时换行。这是我的代码,这里还有一个图片链接以供说明:https://flic.kr/p/22qgZUd

.fd2{
width: 1212px;
height: 617px;
background-color: #bebaba;
position: absolute;
}
.motherbox div{
display: flex;
}

#cp{
font-family: 'Noto Serif', serif;
font-size: 90px;
color: #FFFFFF;
padding: 7px;
text-shadow: 2px 2px 4px #000000;
text-align: right;
}
.one{
display: inline;
position: relative;
font-family: 'Noto Serif', serif;
font-size: 70px;
color: #EA4335;
padding: 7px;
text-shadow: 2px 2px 4px #9A9A9A;
width: 30%;
float: left;

}
.two{
position: relative;
font-family: 'Noto Serif', serif;
font-size: 70px;
color: #4285F4;
padding: 7px;
text-shadow: 2px 2px 4px #9A9A9A;
text-align: right;
width: 30%;
float: left;
}
.three{
position: relative;
font-family: 'Noto Serif', serif;
font-size: 70px;
color: #34A853;
padding: 7px;
text-shadow: 2px 2px 4px #000000;
text-align: right;
width: 30%;
float: left;
}
div.clear{
clear: both;
}
<body>

<!-- particles.js container -->
<div id="particles-js"></div>
<!--<div id="survey"></div>-->

<div class="form-container" id="form" style="display: block;">
<div class="fd2" style="display: block;">
<p class="quick" id="surv">
<h1 id="cp">Quick Survey</h1>
</p>
<div class="motherbox">
<div class="one" id="first">
<p>1:sssssssssssssssssssssssssssssssddddddddddd</p>
</div>
<div class="two" id="second">
<p>2:dddddddddddddddddddddgggggggggggggggggggggg</p>
</div>
<div class="three" id="three">
<p>3:fddggggggggggggggggggggggggggggggggggggggggg</p>
</div>
<br style="float: left;">
</div>
</div>
</div>
<div class="clear"></div>

最佳答案

只需添加这个 css 就可以了

div p{
width: 100%;
overflow-wrap: break-word;
}

.fd2{
width: 1212px;
height: 617px;
background-color: #bebaba;
position: absolute;
}
.motherbox div{
display: flex;
}

#cp{
font-family: 'Noto Serif', serif;
font-size: 90px;
color: #FFFFFF;
padding: 7px;
text-shadow: 2px 2px 4px #000000;
text-align: right;
}
.one{
display: inline;
position: relative;
font-family: 'Noto Serif', serif;
font-size: 70px;
color: #EA4335;
padding: 7px;
text-shadow: 2px 2px 4px #9A9A9A;
width: 30%;
float: left;

}
.two{
position: relative;
font-family: 'Noto Serif', serif;
font-size: 70px;
color: #4285F4;
padding: 7px;
text-shadow: 2px 2px 4px #9A9A9A;
text-align: right;
width: 30%;
float: left;
}
.three{
position: relative;
font-family: 'Noto Serif', serif;
font-size: 70px;
color: #34A853;
padding: 7px;
text-shadow: 2px 2px 4px #000000;
text-align: right;
width: 30%;
float: left;
}
div.clear{
clear: both;
}
div p{
width: 100%;
overflow-wrap: break-word;
}
<body>

<!-- particles.js container -->
<div id="particles-js"></div>
<!--<div id="survey"></div>-->

<div class="form-container" id="form" style="display: block;">
<div class="fd2" style="display: block;">
<p class="quick" id="surv">
<h1 id="cp">Quick Survey</h1>
</p>
<div class="motherbox">
<div class="one" id="first">
<p>1:sssssssssssssssssssssssssssssssddddddddddd</p>
</div>
<div class="two" id="second">
<p>2:dddddddddddddddddddddgggggggggggggggggggggg</p>
</div>
<div class="three" id="three">
<p>3:fddggggggggggggggggggggggggggggggggggggggggg</p>
</div>
<br style="float: left;">
</div>
</div>
</div>
<div class="clear"></div>

关于css - 包含 3 个 div 到 3 列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47800217/

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