排版

font-feature-settings

用于控制高级排版功能的工具类。

ClassStyles
font-features-[<value>]
font-feature-settings: <value>;
font-features-(<custom-property>)
font-feature-settings: var(<custom-property>);

示例

基本示例

使用 font-features-[<value>] 工具类来启用支持的字体中的 OpenType 功能:

<p class="font-features-['smcp'] ...">这段文字使用小型大写字母。</p>

启用多个功能

你可以通过逗号分隔来启用多个 OpenType 功能:

<p class="font-features-['smcp','onum'] ...">这段文字使用小型大写字母和旧式数字。</p>

使用 CSS 变量

使用 font-features-(<custom-property>) 语法从 CSS 变量应用字体功能设置:

<p class="font-features-(--my-features) ...">  <!-- ... --></p>

响应式设计

Prefix a font-feature-settings utility with a breakpoint variant like md: to only apply the utility at medium screen sizes and above:

<p class="font-features-['tnum'] md:font-features-['smcp'] ...">  Lorem ipsum dolor sit amet...</p>

Learn more about using variants in the variants documentation.