现代浏览器中使用css可以实现文本溢出,使用 text-overflow: ellipsis;在有些场景下没有效果,这个时候你需要检查应用的场景是是否是块元素,是否有确切的width。

如果是行内元素则需要使用display设置为inline-block;

 

下面是对a,span等行内元素的使用CSS换行文本溢出显示省略号的比较准确的用法:

a,span
{  
 overflow: hidden;
 text-align: center;
 text-overflow: ellipsis;
 white-space: nowrap;
 display: inline-block;
 width:100px;
 max-width:120px;

} 

 

posted @ 2014-10-21 23:30 daoyuly 阅读(452) 评论(0) 推荐(0) 编辑
摘要: svn: Can't convert string from 'UTF-8' to native encoding 的解决办法 阅读全文
posted @ 2014-09-26 16:30 daoyuly 阅读(1385) 评论(0) 推荐(0) 编辑
摘要: To follow the path: look to the master,(寻找大师) follow the master,(跟随大师) walk with the master,(与大师同行) see through the master,(观摩大师) become the master.(成... 阅读全文
posted @ 2014-08-25 22:41 daoyuly 阅读(205) 评论(0) 推荐(0) 编辑
摘要: less中的减号处理 阅读全文
posted @ 2014-04-02 18:50 daoyuly 阅读(475) 评论(0) 推荐(0) 编辑
摘要: 初识less,为何使用less 阅读全文
posted @ 2014-04-02 18:42 daoyuly 阅读(278) 评论(0) 推荐(0) 编辑
摘要: 纯CSS tooltip 提示 阅读全文
posted @ 2014-03-12 21:19 daoyuly 阅读(343) 评论(0) 推荐(0) 编辑
摘要: javascript版排序算法实现 阅读全文
posted @ 2014-03-12 16:49 daoyuly 阅读(196) 评论(0) 推荐(0) 编辑
摘要: Extjs 源码组成 阅读全文
posted @ 2014-03-04 20:41 daoyuly 阅读(1052) 评论(0) 推荐(0) 编辑
摘要: Windbg使用简明指南 阅读全文
posted @ 2014-02-26 19:52 daoyuly 阅读(5808) 评论(0) 推荐(0) 编辑
摘要: MSI文件 解压 查看 阅读全文
posted @ 2014-02-26 18:54 daoyuly 阅读(2337) 评论(0) 推荐(0) 编辑
点击右上角即可分享
微信分享提示