我用了以下代码实现新闻标题定长截断:
- CSS code
.ellipsis_div{ overflow:hidden; text-overflow:ellipsis; white-space:nowrap; wzy:expression(void(this.title=this.innerText)); }
在IE内核的浏览器里是正常的,但用firefox测试就没有被截断,
网站都做好了,大规模改动很困难,有什么简单的办法补救?
------解决方案--------------------
设定宽度
------解决方案--------------------
没有宽度和高度吗?
------解决方案--------------------
<!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>firefox div </title>
<style type="text/css">
.w {width:400px;}
.d1 {height:50px;float:left;}
.d2 {height:50px;background:#F9EDFA;border:2px dotted #A63DAD;overflow:hidden}
</style>
</head>
<body>
<div class="w">
<div class="d1">aaaaaaaaaaaaaaaaaaaaaaaa</div><div class="d2">bbbbbbbbbbbbaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</div>
</div>
</body>
</html>
------解决方案--------------------
expression(void(this.title=this.innerText));
改成:expression(void(this.title=this.innerHTML));试试
------解决方案--------------------
inline状态下的a?