排版
text-underline-offset
用于控制文本下划线偏移量的工具。
类 | 样式 |
---|---|
underline-offset-<number> | text-underline-offset: <number>px; |
-underline-offset-<number> | text-underline-offset: calc(<number>px * -1); |
underline-offset-auto | text-underline-offset: auto; |
underline-offset-(<custom-property>) | text-underline-offset: var(<custom-property>); |
underline-offset-[<value>] | text-underline-offset: <value>; |
示例(Examples)
¥Examples
基本示例(Basic example)
¥Basic example
使用 underline-offset-<number>
工具(如 underline-offset-2
和 underline-offset-4
)更改文本下划线的偏移量:
¥Use underline-offset-<number>
utilities like underline-offset-2
and underline-offset-4
to change the offset of a text underline:
underline-offset-1
The quick brown fox jumps over the lazy dog.
underline-offset-2
The quick brown fox jumps over the lazy dog.
underline-offset-4
The quick brown fox jumps over the lazy dog.
underline-offset-8
The quick brown fox jumps over the lazy dog.
<p class="underline underline-offset-1">The quick brown fox...</p><p class="underline underline-offset-2">The quick brown fox...</p><p class="underline underline-offset-4">The quick brown fox...</p><p class="underline underline-offset-8">The quick brown fox...</p>
使用自定义值(Using a custom value)
¥Using a custom value
使用 underline-offset-[<value>]
语法 根据完全自定义的值设置 text underline offset:
<p class="underline-offset-[3px] ..."> <!-- ... --></p>
对于 CSS 变量,还可以使用 underline-offset-(<custom-property>)
语法:
<p class="underline-offset-(--my-underline-offset) ..."> <!-- ... --></p>
这只是简写,用于 underline-offset-[var(<custom-property>)]
它会自动为你添加 var()
函数。
响应式设计(Responsive design)
¥Responsive design
在 text-underline-offset
工具前面使用断点变体如 md:
仅在 medium 屏幕尺寸及以上时应用工具:
<p class="underline md:underline-offset-4 ..."> <!-- ... --></p>
请参阅 变体文档 详细了解如何使用变体。