字体排印
用于选择字体的宽度实用工具。
类 | 样式 |
---|---|
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-<百分比> | font-stretch: <百分比>; |
font-stretch-(<自定义属性>) | font-stretch: var(<自定义属性>); |
font-stretch-[<值>] | font-stretch: <值>; |
使用 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-<百分比>
实用工具(如 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-[<值>]
语法 来设置字体宽度基于完全自定义的值
<p class="font-stretch-[66.66%] ..."> <!-- ... --></p>
对于 CSS 变量,您还可以使用 font-stretch-(<自定义属性>)
语法
<p class="font-stretch-(--my-font-width) ..."> <!-- ... --></p>
这只是 font-stretch-[var(<自定义属性>)]
的简写,它会自动为您添加 var()
函数。
前缀一个 font-stretch
实用工具 带有像 md:
这样的断点变体,仅在中等 屏幕尺寸及以上时应用该实用工具
<div class="font-stretch-normal md:font-stretch-expanded ..."> <!-- ... --></div>
在变体文档中了解有关使用变体的更多信息。