我想在鏈接上使用文本溢出屬性。我爲段落工作,但不爲鏈接。文本溢出:鏈接上的省略號
下面是HTML代碼
<div>
<ul>
<li>
<p>the text is too long</p>
</li>
<li>
<a href="javascript:alert('test')">the link is too long</a>
</li>
</ul>
</div>
這裏是CSS代碼:
a {
white-space: nowrap;
width:50px;
overflow: hidden;
text-overflow: ellipsis;
}
p {
white-space: nowrap;
width:50px;
overflow: hidden;
text-overflow: ellipsis;
}
查看http://jsfiddle.net/corinnekm/LLVDB/
非常感謝你的幫助的例子。
感謝,@Gilles,對我幫助很大。 – eyalewin