日期:2014-05-16  浏览次数:20581 次

长字串变省略的css
很长的英文, 想在<td>或<div>中显示两行后出现省略,如:

Ford acolytes hauled the paper before the Ontario Press Council, charging that the Star’s use of unnamed sources was unethical and that the media’s focus on the issue was detrimental to the democratic life of the city.

在td里变成
Ford acolytes hauled the paper
before the Ontario Press Council...

如何能用CSS简单搞掂?

------解决方案--------------------
用javascript截字符串试试  
css里倒是有个类似的功能  不过好像在td里不怎么凑效

overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    width:150px;
------解决方案--------------------
一般都是一行才显示省略号的,如果多行,你可以参考这个插件
http://tpgblog.com/2009/12/21/threedots-the-jquery-ellipsis-plugin/