New!你知道小组可以导入词条、编辑专题页面吗?  

利用伪类after和hack技术对内容进行横向截断

利用伪类after和hack技术对内容进行横向截断!
 li{ list-style:none; padding:0; margin:0}
li a{ font-family:"宋体",Arial, Helvetica, sans-serif; white-space:nowrap; text-overflow:ellipsis; overflow: hidden; font-size:12px; }
li a{ overflow:hidden; max-width:24px;/*for firefox and opera*/ *max-width:45px;/*for ie7.0*/ _width:45px;/*for ie6.0*/ float:left; }
li:after{ content: "..."; padding-left:5px; color: #df3a0e; }
持伪类 after的浏览器将在a内容后面生成“...”,而ie不支持after,但支持它的私有标签text-overflowe,不幸的是opera也支持 ie此私有属性并同时支持after伪类,so只能用hack和其支持max-width的属性对其限制,东西不大,关系却是相当的复杂!

发表讨论

Copyright © 2005-2009 hudong.com Ltd. All Rights Reserved. 互动在线 版权所有