Typography

font-stretch

用於選取字型寬度的通用類別。

ClassStyles
font-stretch-ultra-condensed
font-stretch: ultra-condensed; /* 50% */
font-stretch-extra-condensed
font-stretch: extra-condensed; /* 62.5% */
font-stretch-condensed
font-stretch: condensed; /* 75% */
font-stretch-semi-condensed
font-stretch: semi-condensed; /* 87.5% */
font-stretch-normal
font-stretch: normal; /* 100% */
font-stretch-semi-expanded
font-stretch: semi-expanded; /* 112.5% */
font-stretch-expanded
font-stretch: expanded; /* 125% */
font-stretch-extra-expanded
font-stretch: extra-expanded; /* 150% */
font-stretch-ultra-expanded
font-stretch: ultra-expanded; /* 200% */
font-stretch-<percentage>
font-stretch: <percentage>;
font-stretch-(<custom-property>)
font-stretch: var(<custom-property>);
font-stretch-[<value>]
font-stretch: <value>;

範例(Examples)

基本範例(Basic example)

使用 font-stretch-condensedfont-stretch-expanded 等通用類別來設定字型的寬度:

font-stretch-extra-condensed

The quick brown fox jumps over the lazy dog.

font-stretch-condensed

The quick brown fox jumps over the lazy dog.

font-stretch-normal

The quick brown fox jumps over the lazy dog.

font-stretch-expanded

The quick brown fox jumps over the lazy dog.

font-stretch-extra-expanded

The quick brown fox jumps over the lazy dog.

<p class="font-stretch-extra-condensed">The quick brown fox...</p><p class="font-stretch-condensed">The quick brown fox...</p><p class="font-stretch-normal">The quick brown fox...</p><p class="font-stretch-expanded">The quick brown fox...</p><p class="font-stretch-extra-expanded">The quick brown fox...</p>

此設定僅適用於具有多種寬度變體的字型,否則瀏覽器會選擇最接近的匹配項。

使用百分比(Using percentages)

使用 font-stretch-50%font-stretch-125%font-stretch-<percentage> 通用類別來以百分比設定字型的寬度:

font-stretch-50%

The quick brown fox jumps over the lazy dog.

font-stretch-100%

The quick brown fox jumps over the lazy dog.

font-stretch-150%

The quick brown fox jumps over the lazy dog.

<p class="font-stretch-50%">The quick brown fox...</p><p class="font-stretch-100%">The quick brown fox...</p><p class="font-stretch-150%">The quick brown fox...</p>

使用自訂值(Using a custom value)

使用 font-stretch-[<value>] 語法,根據完全自訂的值來設定 font width

<p class="font-stretch-[66.66%] ...">  Lorem ipsum dolor sit amet...</p>

對於 CSS 變數,你也可以使用 font-stretch-(<custom-property>) 語法:

<p class="font-stretch-(--my-font-width) ...">  Lorem ipsum dolor sit amet...</p>

這只是 font-stretch-[var(<custom-property>)] 的簡寫形式,會自動為你加上 var() 函式。

響應式設計(Responsive design)

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

<div class="font-stretch-normal md:font-stretch-expanded ...">  <!-- ... --></div>

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

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