简体   繁体   English

文字环绕在绝对定位的元素中,没有宽度

[英]Text wrapping in an absolutely positioned element with no width

I have an element structure like this: 我有一个像这样的元素结构:

<div><span></span>My text goes here</div>

both the div and span are positioned absolutely i want the div to expand out to a certain point then wrap to the next line after say 200px. div和span都绝对定位,我希望div扩展到某个点,然后在说200px之后换行到下一行。

At the moment the text breaks pretty much after every other word to a new line, i can fix this by using white-space: nowrap however this stops the text from wrapping at all. 此刻,文本在每隔一个单词之后都换行了很多,我可以通过使用white-space: nowrap来解决此问题white-space: nowrap然而,这完全阻止了文本换行。

How can i get the text the wrap but after a certain width? 如何在固定宽度后获得自动换行?

我不知道我是否知道,但是为什么你不只是把div宽度:200px ;?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM