排版
用于选择字体宽度实用工具。
| 类名 | 样式 |
|---|---|
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>; |
使用类似 font-stretch-condensed 和 font-stretch-expanded 这样的实用工具来设置字体宽度
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
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>这仅适用于具有多种宽度变体的字体,否则浏览器会选择最接近的匹配项。
使用 font-stretch-<percentage> 实用工具(如 font-stretch-50% 和 font-stretch-125%)来使用百分比设置字体宽度
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
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>使用 font-stretch-[<value>] 语法 来设置字体宽度基于完全自定义的值
<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() 函数。
前缀a font-stretch 实用工具 与断点变体(如 md:)一起使用,以便仅在medium 屏幕尺寸及以上尺寸的应用实用工具
<div class="font-stretch-normal md:font-stretch-expanded ..."> <!-- ... --></div>了解更多关于在变体文档中使用变体的信息。