一种风格
#test {
overflow-x: auto;
white-space: pre-wrap; /* css-3 */
white-space: -moz-pre-wrap !important;
white-space: -pre-wrap;
white-space: -o-pre-wrap;
width: 99%;
word-wrap: break-word;
}
#wrap {
margin: 0 auto; width: 50%;
}div测试“id=”中的单词中断如下:
no //this is end of first line
thing //this is beginning of the next line
<div id="wrap">
<div id="test"></div>
</div>最初的单词是nothing
如何解决这个问题?
发布于 2016-12-06 05:41:20
只使用white-space: nowrap;来获取整个单词,而不会中断。但我确信,除非从文本中删除并将其写为nothing,否则无法删除no和thing之间的空格
#test {
overflow-x: auto;
white-space: nowrap;
width: 99%;
word-wrap: normal;
}
#wrap {
margin: 0 auto; width: 50%;
}<div id="wrap">
<div id="test">
no
thing
</div>
</div>
https://stackoverflow.com/questions/40983745
复制相似问题