溢出隐藏
css实现单行溢出隐藏
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
js实现多行溢出隐藏
<dd class="user_star_dd"><p>你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好</p></dd>
overflow: hidden;
height: 30px;
$(".user_star_dd").each(function(i) {
var divH = $(this).height();
var $p = $("p", $(this));
while ($p.outerHeight() > divH) {
$p.text($p.text().replace(/(\s)*([a-zA-Z0-9]+|\W)(\.\.\.)?$/, "..."));
};
})

浙公网安备 33010602011771号