text-overflow:ellipsis;-moz-binding: url('ellipsis.xml#ellipsis'); 文本字符串超过容器长度溢出部分显示点点点省略号"..." ,支持IE6+,Firefox !

 HTML示例文件代码:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> 
<HTML> 
<HEAD> 
<TITLE> New Document </TITLE>
<style> 
.ellipsis
{ 
table-layout
:fixed 
} 
.ellipsis td
{
text-overflow
:ellipsis;/*IE6+样式*/
overflow
:hidden;
white-space
:nowrap;
padding
:2px;
-moz-binding
: url('ellipsis.xml#ellipsis');/*firefox样式*/
} 
</style> 
</HEAD>
<BODY> 
<table cellSpacing="0" cellpadding="1" width="80%" class="ellipsis" border="1"> 
<colgroup> 
<col> 
<col width="100"> 
</colgroup> 
<tBody> 
<tr> 
<td><href="http://www.cnblogs.com/manyeyes/">manyeyes————文本字符串超过容器长度溢出部分显示点点点省略号"..."ManyEyes————文本字符串超过容器长度溢出部分显示点点点省略号"..."</a></td> 
<td>ManyEyes</td> 
</tr> 
<tr> 
<td><href="http://www.cnblogs.com/manyeyes/">manyeyes————文本字符串超过容器长度溢出部分显示点点点省略号"..."ManyEyes————文本字符串超过容器长度溢出部分显示点点点省略号"..."</a></td> 
<td>ManyEyes</td> 
</tr> 
<tr> 
<td><href="http://www.cnblogs.com/manyeyes/">manyeyes————文本字符串超过容器长度溢出部分显示点点点省略号"..."ManyEyes————文本字符串超过容器长度溢出部分显示点点点省略号"..."</a></td> 
<td>ManyEyes</td> 
</tr> 
</tBody> 
</table> 
</BODY> 
</HTML>

 

 

 

 XML文件代码,文件名:ellipsis.xml 
<?xml version="1.0"? encoding="utf-8" ?>
<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:window>
        
<xul:description crop="end" xbl:inherits="value=xbl:text">
          
<children/>
        
</xul:description>
      
</xul:window>
    
</content>
  
</binding>
</bindings>

 

posted @ 2010-10-27 16:07  从孑开始  阅读(614)  评论(1编辑  收藏  举报