test.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>测试</title>
<style>
body{text-align:center;margin:0;padding:0}
.test{width:200px;background:#603;margin:10px auto 0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;-moz-binding:url('ellipsis.xml#ellipsis');}
</style>
</head>
<body>
<div class="test">测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试
</div>
</body>
</html>
ellipsis.xml
<?xml version="1.0"?>
<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>
本文展示了一个使用HTML和CSS进行网页布局的例子,通过简单的样式实现了文本溢出省略效果。
284

被折叠的 条评论
为什么被折叠?



