六狼论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

搜索
查看: 233|回复: 0

兼容浏览器的CSS控制字符宽度省略号效果

[复制链接]

升级  0%

12

主题

12

主题

12

主题

秀才

Rank: 2

积分
50
 楼主| 发表于 2013-2-8 00:57:00 | 显示全部楼层 |阅读模式
<style>
* { margin: 0; padding: 0; }
a { text-decoration: none; color: #000; }
a:hover { text-decoration: none; color: #000; }
ul {width: 300px;height:120px; margin: 40px auto;padding: 12px 4px 12px 24px;border: 1px solid #D4D4D4;background: #F1F1F1;}
li { margin: 12px 0; }
li a {display: block;width: 120px;overflow: hidden;/*注意不要写在最后了*/white-space: nowrap;-o-text-overflow: ellipsis;text-overflow: ellipsis;}
/* firefox only */
li:not(p) {clear: both;}
li:not(p) a {max-width: 170px;float: left;}
li:not(p):after {content: "...";float: left;width: 25px;padding-left: 5px;color: #000;}
</style>

///底下是内容

<ul>
<li><a  href=http://www.52css.com/"<a href="http://www.52css.com/" target="_blank" target="_blank">http://www.52css.com/</a>">使用CSS最佳习惯 </a></li>
<li><a  href=http://www.52css.com/"<a href="http://www.52css.com/" target="_blank" target="_blank">http://www.52css.com/</a>">说说XHTML中的alt属性和title属性 </a></li>
<li><a  href=http://www.52css.com/"<a href="http://www.52css.com/" target="_blank" target="_blank">http://www.52css.com/</a>">IE中伪类:hover的使用及BUG </a></li>
<li><a  href=http://www.52css.com/"<a href="http://www.52css.com/" target="_blank" target="_blank">http://www.52css.com/</a>">52CSS公告</a></li>
</ul>
您需要登录后才可以回帖 登录 | 立即注册 新浪微博账号登陆

本版积分规则

快速回复 返回顶部 返回列表