text-overflow樣式屬性值ellipsis的使用方法,overflowellipsis

來源:互聯網
上載者:User

text-overflow樣式屬性值ellipsis的使用方法,overflowellipsis

        一、div標籤中使用text-overflow樣式屬性值ellipsis的方法:

<!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><title>div標籤中使用text-overflow樣式屬性值ellipsis的方法</title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/></head><body><div style="width:200px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; border:1px solid #336699;">有志氣者不會甘居下遊,有見識者不敢自滿自足,有恒心者斷無不成之事!</div> </body></html>

        二、table標籤子標籤td標籤中使用text-overflow樣式屬性值ellipsis的方法:

<!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><title>table標籤子標籤td標籤中使用text-overflow樣式屬性值ellipsis的方法</title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/></head><body><table cellSpacing="0" cellpadding="1" width="456" border="1" style="table-layout:fixed;"><tr><td style="text-overflow:ellipsis; overflow:hidden; white-space:nowrap; padding:2px;">有志氣者不會甘居下遊,有見識者不敢自滿自足,有恒心者斷無不成之事!</td></tr></table> </body></html>

        說明:代碼二中的例子在某些瀏覽器(比如:Opera瀏覽器)中是達不到相應的效果的。


{text-overflow:ellipsis;}css裡的這個屬性在DW裡面的什地方?我怎找不到?

DW中沒有這種屬性,自己改css就是了 ,而且這個屬性FF不支援
 
CSS屬性text-overflow是在什地方插入的????

text-overflow有兩個屬性:
clip簡單剪下文本
ellipsis剪下文本後顯示省略符號
在div中單獨使用text-overflow是沒有效果的,必須下面兩個一起使用:
white-space:nowrap 強制不換行
overflow:hidden 溢出部分隱藏
例如:
<div style="width: 200px; height: 25px;text-overflow:ellipsis; white-space:nowrap;overflow:hidden">中華人民共和國中華人民共和國</div>
也可以寫個css式樣,class引用它。
<style type="text/css">
.mydiv{
text-overflow:ellipsis;
white-space:nowrap;
overflow:hidden;
width: 200px; height: 25px;
}
</style>
然後:
<div class="mydiv">中華人民共和國中華人民共和國</div>
 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.