text

英[tekst]? ?美[t?kst]??

n.文本,原文;課文,教科書;主題;版本

#v .傳簡訊

overflow

S[???v??fl??]? ?美[?o?v?r?flo?]??

vt.& vi.溢出,淹沒;擠滿,充滿淹沒;洋溢;資源過剩

n.氾濫,溢出物;溢流管;充溢,過多;超出額

vi.氾濫,溢出;充溢

adj.溢出的,滿出的

CSS 文字溢出屬性 語法

作用:text-overflow 屬性規(guī)定當(dāng)文字溢出包含元素時發(fā)生的事情。

語法:text-overflow: clip|ellipsis|string

說明:clip ? ?修剪文字。? ? ? ? ellipsis ? ?顯示省略符號來代表被修剪的文字。? ?string ? ?使用給定的字串來代表被修剪的文字。? ??

註解:所有主流瀏覽器都支援 text-overflow 屬性。

CSS 文字溢出屬性 範(fàn)例

<!DOCTYPE html>
<html>
<head>
<style> 
div.test
{
white-space:nowrap; 
width:12em; 
overflow:hidden; 
border:1px solid #000000;
}
</style>
</head>
<body>
<p>下面兩個 div 包含無法在框中容納的長文本。正如您所見,文本被修剪了。</p>
<p>這個 div 使用 "text-overflow:ellipsis" :</p>
<div class="test" style="text-overflow:ellipsis;">This is some long text that will not fit in the box</div>
<p>這個 div 使用 "text-overflow:clip":</p>
<div class="test" style="text-overflow:clip;">This is some long text that will not fit in the box</div>
</body>
</html>
執(zhí)行實例 ?

#點擊 "執(zhí)行實例" 按鈕查看線上實例

#