边框
用于控制元素轮廓偏移的实用工具。
类 | 样式 |
---|---|
outline-offset-<number> | outline-offset: <number>px; |
-outline-offset-<number> | outline-offset: calc(<number>px * -1); |
outline-offset-(<custom-property>) | outline-offset: var(<custom-property>); |
outline-offset-[<value>] | outline-offset: <value>; |
使用类似 outline-offset-2
和 outline-offset-4
这样的实用工具来更改元素轮廓的偏移
outline-offset-0
outline-offset-2
outline-offset-4
<button class="outline-2 outline-offset-0 ...">Button A</button><button class="outline-2 outline-offset-2 ...">Button B</button><button class="outline-2 outline-offset-4 ...">Button C</button>
使用 outline-offset-[<value>]
语法 来设置outline offset基于完全自定义的值
<div class="outline-offset-[2vw] ..."> <!-- ... --></div>
对于 CSS 变量,你也可以使用 outline-offset-(<custom-property>)
语法
<div class="outline-offset-(--my-outline-offset) ..."> <!-- ... --></div>
这只是 outline-offset-[var(<custom-property>)]
的简写形式,它会自动为你添加 var()
函数。
前缀为 outline-offset
实用工具 添加类似 md:
这样的断点变体,以仅在中等 屏幕尺寸及以上应用该实用工具
<div class="outline md:outline-offset-2 ..."> <!-- ... --></div>
了解更多关于在变体文档中使用变体的信息。变体文档。