CSS 如何在 div 多行中制作文本?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11946877/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to make text inside a div multiline?
提问by Ashwin Singh
Possible Duplicate:
wrapping the text inside div - css
可能的重复:
将文本包裹在 div 中 - css
Fiddle: http://jsfiddle.net/aTFK2/2/
小提琴:http: //jsfiddle.net/aTFK2/2/
HTML:
HTML:
<div id="ChannelDescription">ThisIsAVeryLongTextWithoutAnySpacesLoremIpsumDolorSitAmedLoremIpsumDolorSitAmedLoremIpsumDolorSitAmedLoremIpsumDolorSitAmedLoremIpsumDolorSitAmedLoremIpsumDolorSitAmedLoremIpsumDolorSitAmedLoremIpsumDolorSitAmedLoremIpsumDolorSitAmed</div>?
CSS:
CSS:
#ChannelDescription {
width:560px;
color:Gray;
white-space:normal;
font-size:14px;
}?
NOTE: I cannot change the width to any other value. Neither can I use break points. I am looking for a pure CSS2 solution.
注意:我不能将宽度更改为任何其他值。我也不能使用断点。我正在寻找纯 CSS2 解决方案。
回答by Noah Wetjen
word-wrap: break-word;
will solve the problem.
word-wrap: break-word;
将解决问题。