现在的位置: 首页 > 综合 > 正文

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

2013年02月04日 ⁄ 综合 ⁄ 共 782字 ⁄ 字号 评论关闭

以前写的,放在这里:

.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;
}

 

抱歉!评论已关闭.