日期:2013-05-19  浏览次数:20922 次

核心提示:用CSS把标题超出的部分变成...

<html>
<body>
<style>
.ellipsis span {
   white-space:nowrap;
   text-overflow:ellipsis; /* for internet explorer */
   overflow:hidden;
   width:190px;
   display:block;
}
html>body .ellipsis {
   clear:both;
}
html>body .ellipsis span:after {
   content: "...";
}
html>body .ellipsis span {
   max-width:180px;
   width:auto !important;
   float:left;
}
</style>
<div class="ellipsis">
<span>多特软件站_中国最快最安全的软件下载站_六大杀毒软件检测</span>
</div>
</body>
</html>

这个虽然是个好方法,可以不用程序控制了,而且也方便修正,但缺陷是firefox浏览器不支持。