单行文本溢出
| 1 | overflow: hidden; | 
多行文本溢出
方法1(存在兼容性,兼容移动端)
| 1 | overflow : hidden; | 
方法2(伪类实现,只适合已确定超出指定行数的)
| 1 | p{ | 
方法3(jQuery.dotdotdot)
参考:Github、官网
2
3
4
5
$("#wrapper").dotdotdot({
// configuration goes here
});
});
方法4(Clamp.js)
参考:https://github.com/josephschmitt/Clamp.js
2
3
$clamp(module, {clamp: 3});
方法5(ftellipsis.js)
参考:https://github.com/ftlabs/ftellipsis
2
3
4
5
var ellipsis = new Ellipsis(element);
ellipsis.calc();
ellipsis.set();