我有包装问题.我正在生成一些hexencoding加密,输出太长了像;
827938828ey823876te37257e5t328er6367r5erd663275e65r532r6s3624e5645376er563rdr753624e544341763r567r4e56r326r5632r65sr32dr32udr56r634r57rd63725
它继续.当我把它放在div中时,即使我指定一个特定的宽度它也不会包裹它,因为它们都在一起.如果div不足以支持一行,我希望它从下一行继续.
我怎样才能做到这一点?
ada*_*shr 59
你不能包装那个文本,因为它没有任何空格.您需要一个JavaScript或服务器端解决方案,它在几个字符后分割字符串.
编辑
您需要在CSS中添加此属性.
word-wrap: break-word;
imm*_*odi 17
我在这里发现了一些奇怪的事情,word-wrap
只能width
正确处理css的属性.
HTML:
#ONLYwidth {
width: 200px;
}
#wordwrapWITHOUTWidth {
word-wrap: break-word;
}
#wordwrapWITHWidth {
width: 200px;
word-wrap: break-word;
}
Run Code Online (Sandbox Code Playgroud)
CSS:
<b>This is the example of word-wrap only using width property</b>
<p id="ONLYwidth">827938828ey823876te37257e5t328er6367r5erd663275e65r532r6s3624e5645376er563rdr753624e544341763r567r4e56r326r5632r65sr32dr32udr56r634r57rd63725</p>
<br/>
<b>This is the example of word-wrap without width property</b>
<p id="wordwrapWITHOUTWidth">827938828ey823876te37257e5t328er6367r5erd663275e65r532r6s3624e5645376er563rdr753624e544341763r567r4e56r326r5632r65sr32dr32udr56r634r57rd63725</p>
<br/>
<b>This is the example of word-wrap with width property</b>
<p id="wordwrapWITHWidth">827938828ey823876te37257e5t328er6367r5erd663275e65r532r6s3624e5645376er563rdr753624e544341763r567r4e56r326r5632r65sr32dr32udr56r634r57rd63725</p>
Run Code Online (Sandbox Code Playgroud)
这是一个我准备好的工作演示.http://jsfiddle.net/Hss5g/2/
我知道它太晚了,但它可以帮助别人!