1. 变换
  2. 背面可见性

变换

背面可见性

用于控制元素的背面是否可见的工具。

ClassStyles
背面隐藏
backface-visibility: hidden;
背面可见
backface-visibility: visible;

示例

基本示例

使用 backface-visible 工具,即使元素旋转到视线外,也可以显示元素的背面,比如一个立方体:

背面隐藏

1
2
3
4
5
6

背面可见

1
2
3
4
5
6
<div class="size-20 ...">
<div class="translate-z-12 rotate-x-0 bg-sky-300/75 backface-hidden ...">1</div>
<div class="-translate-z-12 rotate-y-180 bg-sky-300/75 backface-hidden ...">2</div>
<div class="translate-x-12 rotate-y-90 bg-sky-300/75 backface-hidden ...">3</div>
<div class="-translate-x-12 -rotate-y-90 bg-sky-300/75 backface-hidden ...">4</div>
<div class="-translate-y-12 rotate-x-90 bg-sky-300/75 backface-hidden ...">5</div>
<div class="translate-y-12 -rotate-x-90 bg-sky-300/75 backface-hidden ...">6</div>
</div>
<div class="size-20 ...">
<div class="translate-z-12 rotate-x-0 bg-sky-300/75 backface-visible ...">1</div>
<div class="-translate-z-12 rotate-y-180 bg-sky-300/75 backface-visible ...">2</div>
<div class="translate-x-12 rotate-y-90 bg-sky-300/75 backface-visible ...">3</div>
<div class="-translate-x-12 -rotate-y-90 bg-sky-300/75 backface-visible ...">4</div>
<div class="-translate-y-12 rotate-x-90 bg-sky-300/75 backface-visible ...">5</div>
<div class="translate-y-12 -rotate-x-90 bg-sky-300/75 backface-visible ...">6</div>
</div>

响应式设计

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

<div class="backface-visible md:backface-hidden ...">
<!-- ... -->
</div>

Learn more about using variants in the variants documentation.