gpt4 book ai didi

html - 将文本换行到 div 内的新行

转载 作者:行者123 更新时间:2023-12-03 22:49:09 25 4
gpt4 key购买 nike

我有两个 div,其中的文本经常会发生变化。当两个 div 内的内容变为容器 div 的两倍宽时,我希望左侧 div 将文本换行到新行。

这是我想要的结果:
This is my desired result:

<html>
<head>
<style type="text/css">
#header {
position:relative;
height: 100px;
width:150PX;
}

#leftdiv {
position: absolute;
float:left;
left:0px;
bottom:0px;
font-size: 10px;
}

#rightdiv {
position:absolute;
float:right;
right:0px;
bottom:0px;
font-size: 10px;
}
</style>
</head>
<body>
<div id="header">
<div id="leftdiv">Content in Left Div</div>
<div id="rightdiv">Content in Right More</div>
</div>
</body>
</html>

最佳答案

用这个 word-wrap: break-word;
分配所有您希望文本包裹类的 div,然后使用 word-wrap: break-word; 设置该类的样式

关于html - 将文本换行到 div 内的新行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19307596/

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