css让文字,字母折行

加上如下的CSS设置,就是设定好宽度width,然后设置合适的word-wrapword-break属性:

.breakAll{
  white-space:normal;
  word-break:keep-all;
  word-wrap: break-word;
}

word-warp 属性设置如何处理单词的折行,可以取的值有ul里面的li折行其实跟其他块状(block)元素的折行都是一样的。以下是相关的CSS属性:

word-wrap: normal | break-word

word-break 属性设置如何处理单词折断,仅支持IE,可以取的值有:

word-break: normal | break-all | hyphenate

white-space 属性设置如何处理元素内的空白。可以取的值有:

white-space: normal | nowarp | pre | pre-line | pre-warp | inherit

经测试对中文也有效。