CSS 实现多余文字省略号的方法:
CSS 实现多余文字省略号的方法:
1 设置width, 或者max-width,规定超过多少长度是越界
2 设置white-space:nowrap;overflow:hidden;-o-text-overflow:ellipsis;text-overflow:ellipsis;vertical-align:top;
white-space:nowrap;是文字显示在一行,即使越界也不换行
overflow:hidden;多余的部分隐藏起来
text-overflow:ellipsis以'...'代表省略部分
vertical-align:top;垂直对齐的基准线设置为顶部。
兼容性:
ie6+
firefox7+(低于7不知道)
chrome
-o属性是为oprea准备的
浙公网安备 33010602011771号