css文本

text-overflow

该属性配合overflow-hidden使用更佳,表示在内容溢出时,文本内容所显示的样式.
常用overflow:ellipsis;

white-space

该属性控制文本中的空格样式,为normal时,就就是浏览器默认处理空格时,html中的空格会被自动忽略的。

This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text.

这段代码的效果会是这样的


css文本_第1张图片
测试

使用white-space:pre;可以保留空格,效果相当于使用了

标签。在展示源代码的时候可以用的上。
white-space:nowrap可以强制文本不换行,保持在同一行。

word-wrap

word-wrap属性允许长的内容可以自动换行。当遇到长文本的时候,由浏览器处理的换行可能溢出,加上
word-wrap:break-word就可以解决.

你可能感兴趣的:(css文本)