css全兼容的字符串"截取"

以前写的,放在这里:

.ellipsis{text-overflow:ellipsis;white-space:nowrap;overflow:hidden;-o-text-overflow:ellipsis;-moz-binding:url('ellipsis.xml#ellipsis');display:block;}

 

ellipsis.xml

代码
<bindings xmlns="http://www.mozilla.org/xbl" xmlns:xbl="http://www.mozilla.org/xbl" xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> 
  
<binding id="ellipsis"> 
    
<content> 
      
<xul:description crop="end" xbl:inherits="value=xbl:text"> 
        
<children/> 
      
</xul:description> 
    
</content> 
  
</binding> 
</bindings>

 

 .ellipsis{

    text-overflow:ellipsis;/*for IE ...*/
    -o-text-overflow
:ellipsis;/*for opera*/
    -moz-binding
:url('ellipsis.xml#ellipsis');/*for firefox,需要下面的xml才有效*/
    display
:block;/*这几个是额外项,加上之后 上面样式才会有效果*/
    white-space
:nowrap;
    overflow
:hidden;
}

 


If you could provide any suggestions or comments for this article, it is always welcome.

标签: css, ellipsis, string
posted @ 2010-09-29 13:32 sohighthesky 阅读(227) 评论(4) 编辑 收藏

 回复 引用 查看   
#1楼[楼主] 2010-09-29 15:15 sohighthesky      
另外要指定width才行
 回复 引用 查看   
#2楼 2010-09-30 10:24 zsea      
解释一下噻
 回复 引用 查看   
#3楼[楼主] 2010-09-30 10:35 sohighthesky      
@zsea
应你回复,稍加了注释

 回复 引用 查看   
#4楼 2010-09-30 17:00 zsea      
谢谢哎