可能重複:
Is it possible to implement the effect of overflow:ellipsis with javascript or css?
How do I indicate long text into a smaller fixed column with CSS?CSS:如何限制使用顯示文本 「...」
我要修剪文本,如果它是大於300像素寬「...」
例如,如果我有:
<ul>
<li>this is greater than 300px, than only display as much of the text that is 300px wide and then replace the remaining text with "..."</li>
<li>short, don't trim</li>
</ul>
將顯示爲:
this is greater than 300px, than only ...
short, don't trim
|----------- 300px wide ----------------|
我將如何做到這一點與CSS/HTML?
可能重複(HTTP:/ /stackoverflow.com/questions/2995656/)和http://stackoverflow.com/questions/3067696和http://stackoverflow.com/questions/802175/和http://stackoverflow.com/questions/486563/男子我我對這個問題感到無聊 – 2010-10-11 21:23:17
我嘗試了上面的內容,並沒有使用** pure ** CSS/HTML。它只適用於我使用JQuery並且不想使用JQuery。 – Jason 2010-10-12 15:52:01
**這可能是重複的,但我還沒有找到一個純CSS/HTML的答案,工程。有一些建議使用鏈接代碼,但代碼不起作用。** http://stackoverflow.com/questions/2108740/how-do-i-indicate-long-text-into-a-smaller-fixed-列與CSS/2109035#2109035 – Jason 2010-10-12 16:12:37