設(shè)置或檢索是否使用一個(gè)省略標(biāo)記(…)標(biāo)示對(duì)象內(nèi)文本的溢出。對(duì)應(yīng)的腳本特性為textOverflow。
<div style=”width:100px;height:20px;text-overflow:ellipsis; white-space:nowrap; overflow:hidden; “>a b c d e f g h i j k l , msa sd sd sa w df f </div>
text-overflow屬性僅是注解,當(dāng)文本溢出時(shí)是否顯示省略標(biāo)記。并不具備其它的樣式屬性定義。我們想要實(shí)現(xiàn)溢出時(shí)產(chǎn)生省略號(hào)的效果。還必須定義:強(qiáng)制文本在一行內(nèi)顯示(white-space:nowrap)及溢出內(nèi)容為隱藏(overflow:hidden)。只有這樣才能實(shí)現(xiàn)溢出文本顯示省略號(hào)的效果。
一、僅定義text-overflow:ellipsis; 不能實(shí)現(xiàn)省略號(hào)效果。
二、定義text-overflow:ellipsis; white-space:nowrap; 同樣不能實(shí)現(xiàn)省略號(hào)效果
三、同時(shí)應(yīng)用: text-overflow:ellipsis; white-space:nowrap; overflow:hidden; 可實(shí)現(xiàn)所想要得到的溢出文本顯示省略號(hào)效果:
新聞熱點(diǎn)
疑難解答
圖片精選