1.word-wrap:break-word与word-break:break-all
共同点是都能把长单词强行断句;
不同点是word-wrap:break-word会首先起一个新行来放置长单词,新的行还是放不下这个长单词则会对长单词进行强制断句;而word-break:break-all则不会把长单词放在一个新行里,当这一行放不下的时候就直接强制断句了。
2. word-break 属性规定自动换行的处理方法:
word-break: normal|break-all(允许在单词内换行)|keep-all(只能在半角空格或连字符处换行)。
word-wrap 属性允许长单词或 URL 地址换行到下一行:
word-wrap: normal|break-word。
3.word-spacing 属性增加或减少单词间的空白(即字间隔),值可能为:normal|length|inherit.
4、white-space:nowrap;用于处理元素内的空白,只在一行内显示。
值 | 描述 |
---|---|
normal | 默认。空白会被浏览器忽略。 |
pre | 空白会被浏览器保留。其行为方式类似 HTML 中的 <pre> 标签。 |
nowrap | 文本不会换行,文本会在在同一行上继续,直到遇到 <br> 标签为止。 |
pre-wrap | 保留空白符序列,但是正常地进行换行。 |
pre-line | 合并空白符序列,但是保留换行符。 |
inherit | 规定应该从父元素继承 white-space 属性的值。 |
5、overflow:hidden;超出边界的部分隐藏。
6、text-overflow:ellipsis|clip; 超出部分显示省略号。