<pre name="code" class="html"><!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>css省略号text-overflow超出溢出显示省略号</title>
<meta http-equiv="Content-type" content="text/html;charset=utf-8"/>
<style type="text/css">
*{
padding: 0;
margin: 0;
}
a{
text-decoration: none;
color: #6699ff
}
ul,li{
list-style: none;
text-align: left;
}
#divcss5{
border:1px solid #ff8000;
padding: 10px;
width: 150px;
margin-left: 10px;
margin-top:10px;
}
#divcss5 li{
width: 150px;
height:24px;
line-height: 24px;
font-size: 12px;
color: #6699ff;
text-overflow:ellipsis;
overflow:hidden;
white-space: nowrap;
}
</style>
</head>
<body>
<ul id="divcss5">
<li><a href="#">显示不完显示省略号,测试内容</a></li>
<li><a href="#">第二排测试内容超出显示省</a></li>
<li><a href="#">能显示完几个字</a></li>
</ul>
</body>
</html>
text-overflow省略号样式总结
要想隐藏溢出内容同时又想让过多内容以省略号样式显示,需要用到css overflow,和text-overflow样式,同时避免文字自动换行我们使用white-space:nowrap标签强制内容不换行,使用使用注意这几个CSS样式和HTML标签配合使用才能达到多余文字内容出现省略号样式