width:150px;/*要显示文字的宽度*/
overflow:hidden; /*超出的部分隐藏起来。*/ 
white-space:nowrap;/*不显示的地方用省略号...代替*/
text-overflow:ellipsis;/* 支持 IE */
<html>
<head>
<style type="text/css">
div
{
width:250px;/*要显示文字的宽度*/
overflow:hidden; /*超出的部分隐藏起来。*/ 
white-space:nowrap;/*不显示的地方用省略号...代替*/
text-overflow:ellipsis;/* 支持 IE */
}
</style>
</head>
<body>
<div>
这是一些文本。这是一些文本。这是一些文本。这是一些文本。这是一些文本。这是一些文本。这是一些文本。这是一些文本。这是一些文本。
</div>
</body>
</html>

效果:

CSS 文字太多用省略号表示

 

相关文章:

  • 2022-01-07
  • 2021-10-18
  • 2021-12-12
  • 2022-12-23
  • 2022-01-10
  • 2021-08-30
  • 2021-08-24
猜你喜欢
  • 2022-01-22
  • 2021-12-12
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-12
相关资源
相似解决方案