码迷,mamicode.com
首页 > Web开发 > 详细

CSS 文本溢出时显示省略标记

时间:2017-11-06 15:03:34      阅读:225      评论:0      收藏:0      [点我收藏+]

标签:har   col   ict   ellipsis   tle   w3c   显示   基本   html   

如标题所示...

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">  
<html xmlns="http://www.w3.org/1999/xhtml">  
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />  
<title>CSS 文本溢出时显示省略标记</title>  
<style type="text/css">
.overflowTest{
    width:200px;/*基本容器显示宽度*/
    overflow:hidden;/*overflow 属性规定当内容溢出元素框时发生的事情。*/
    text-overflow:ellipsis;/*clip:修剪文本|ellipsis:显示省略符号来代表被修剪的文本|string:使用给定的字符串来代表被修剪的文本(自定义)*/
    white-space:nowrap;/*文本不会换行*/
}
</style>
</head>
<body>
<div>正常显示:qwertyuiopasdfghjklzxcvb</div>
<div class="overflowTest">处理后:qwertyuiopasdfghjklzxcvb</div>
</body>
</html> 

 

CSS 文本溢出时显示省略标记

标签:har   col   ict   ellipsis   tle   w3c   显示   基本   html   

原文地址:http://www.cnblogs.com/zhufu9426/p/7792882.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!