六狼论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

搜索
查看: 56|回复: 0

兼容IE6、7、8和FF的省略号

[复制链接]

升级  50%

106

主题

106

主题

106

主题

举人

Rank: 3Rank: 3

积分
350
 楼主| 发表于 2013-2-7 15:15:27 | 显示全部楼层 |阅读模式
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html>    <head>        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">    </head> <BODY>  <style type="text/css">#wrap{width:560px;border:1px solid #333;/* 以下为控制省略号的样式 */overflow:hidden;text-overflow:ellipsis;white-space:nowrap;/* 以下是FF特有属性,需要XUL文件支持 */-moz-binding:url("ellipsis.xml#ellipsis");}</style><div id="wrap">Always in center!Always in center!Always in center!Always in center!Always in center!Always in center!Always in center!Always in center!Always in center!Always in center!</div> </BODY></html>
支持FF所需要的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:description crop="end" xbl:inherits="value=xbl:text"><children/></xul:description>    </content>  </binding></bindings>
IE下,对于loose.dtd的文档类型,span是不受width属性控制的,需要使用div
FF中,span都不受width属性影响
您需要登录后才可以回帖 登录 | 立即注册 新浪微博账号登陆

本版积分规则

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