搜尋
  • 登入
  • 報名
密碼重置成功

關注您感興趣的項目並了解有關它們的最新消息

程式設計字典

服務程式設計師的線上技術手冊
熱門搜尋:
詞典首頁 HTML/CSS CSS CSS 文字溢出屬性
CSS 文字溢出屬性 使用方法詳細解說

CSS 文字溢出屬性

中文翻譯 最近更新: 2018-05-09 14:28:09

text

英[tekst]   美[tɛkst]  

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

#v .傳簡訊

overflow

S[ˌəʊvəˈfləʊ]   美[ˌoʊvərˈfloʊ]  

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

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

vi.氾濫,溢出;充溢

adj.溢出的,滿出的

CSS 文字溢出屬性 語法

作用:text-overflow 屬性規定當文字溢出包含元素時發生的事情。

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

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

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

CSS 文字溢出屬性 範例

<!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>
執行實例 »

#點擊 "執行實例" 按鈕查看線上實例

#
CSS 文字溢出屬性