用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>www.aa25.cn—毛毛虫是怎么渡过面前的大河的?答案长成蝴蝶
</span>
</div>
</body>
</html>


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