Typography

text-overflow

用於控制元素文字溢出行為的通用類別。

ClassStyles
truncate
overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
text-ellipsis
text-overflow: ellipsis;
text-clip
text-overflow: clip;

範例(Examples)

截斷文字(Truncating text)

使用 truncate 通用類別來防止文字換行,並在需要時以省略號(…)截斷溢出的文字:

The longest word in any of the major English language dictionaries is pneumonoultramicroscopicsilicovolcanoconiosis, a word that refers to a lung disease contracted from the inhalation of very fine silica particles, specifically from a volcano; medically, it is the same as silicosis.

<p class="truncate">The longest word in any of the major...</p>

加上省略號(Adding an ellipsis)

使用 text-ellipsis 通用類別在需要時以省略號(…)截斷溢出的文字:

The longest word in any of the major English language dictionaries is pneumonoultramicroscopicsilicovolcanoconiosis, a word that refers to a lung disease contracted from the inhalation of very fine silica particles, specifically from a volcano; medically, it is the same as silicosis.

<p class="overflow-hidden text-ellipsis">The longest word in any of the major...</p>

裁剪文字(Clipping text)

使用 text-clip 通用類別在內容區域的邊界處截斷文字:

The longest word in any of the major English language dictionaries is pneumonoultramicroscopicsilicovolcanoconiosis, a word that refers to a lung disease contracted from the inhalation of very fine silica particles, specifically from a volcano; medically, it is the same as silicosis.

<p class="overflow-hidden text-clip">The longest word in any of the major...</p>

這是瀏覽器的預設行為。

響應式設計(Responsive design)

text-overflow 通用類別前面加上像 md: 這樣的中斷點變體,讓該通用類別只在中型螢幕尺寸及以上時套用:

<p class="text-ellipsis md:text-clip ...">  Lorem ipsum dolor sit amet...</p>

變體文件中了解更多關於使用變體的資訊。

Copyright © 2026 Tailwind Labs Inc.·商標政策(Brand)