我想限制一个文本块的宽度,因此它将看起来像每行的ned都有br。
这样的事情
Texttttttttttttttttttttt tttttttttttttttttttttttt tttttttttttttttttttttttt
由此:
Texttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt
我试图指定div或p的宽度,但对我来说并不奏效。有什么建议么?
解决方法
你可以这样应用css:
div { word-wrap: break-word; width: 100px; }
通常浏览器不会打破单词,而是单词:break-word;也会强迫它打破话语。
更多关于word-wrap的信息