这个是看 猫猫 那个改的 之前我用的 width: expression(this.clientWidth > 200? "200px" :this.clientWidth);

复制内容到剪贴板
代码:
<!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=gb2312" />
<title>无标题文档</title>
</head>
<style type="text/css">
<!--
body{
margin:0px;
padding:0px;
font-size:12px;
line-height:22px;
}
a {
text-decoration:none;
}
div,ul,li,img,p{
margin:0;
padding:0;
border:none;
list-style-type:none;
}
.newsList{
margin:0px;
width:300px;
overflow:hidden;
border:#000000 1px solid;
}
.newsList ul{
overflow:hidden;
}
.newsList li{
width:300px;
border-bottom:1px dotted #ddd;
list-style:none;
height:2em;
overflow:hidden;
}
.newsList li a{
float:left;
width:auto;
height:2em;
position:relative; /*对象不可层叠,但将依据 left , right , top , bottom 等属性在正常文档流中偏移位置*/
padding:0 70px 0 5px; /* 右边距= 10px + 12px(font-size)x5(span内中文字数) */
overflow:hidden;
}
.newsList li a span {
color:#6CF;
background:#fff;
position:absolute;/*将对象从文档流中拖出,使用 left , right , top , bottom 等属性相对于其最接近的一个最有定位设置的父对象进行绝对定位。如果不存在这样的父对象,则依据 body 对象。而其层叠通过 z-index 属性定义*/
padding-left:10px;
top:0;
right:0;
}
-->
</style>
<body>
<div class="newsList">
<ul>
<li><a href="#1">文本溢出自动省略测试文本溢出自动省略测试<span>2009-10-10</span></a></li>
<li><a href="#1">文本溢出自动省略<span>2009-10-10</span></a></li>
<li><a href="#1">文本溢出自动省略测试文本溢出自<span>2009-10-10</span></a></li>
</ul>
</div>
</body>
</html>padding:0 70px 0 5px; /* 右边距= 10px + 12px(font-size)x5(span内中文字数) */
这一行该如何理解
[
本帖最后由 无光 于 2009-10-23 16:27 编辑 ]