变换
用于变换元素的工具。
| Class | Styles |
|---|---|
transform-(<custom-property>) | transform: var(<custom-property>); |
transform-[<value>] | transform: <value>; |
transform-none | transform: none; |
transform-gpu | transform: translateZ(0) var(--tw-rotate-x) var(--tw-rotate-y) var(--tw-rotate-z) var(--tw-skew-x) var(--tw-skew-y); |
transform-cpu | transform: var(--tw-rotate-x) var(--tw-rotate-y) var(--tw-rotate-z) var(--tw-skew-x) var(--tw-skew-y); |
如果您的过渡在 GPU 渲染时比在 CPU 渲染时效果更好,可以通过添加 transform-gpu 工具来强制使用硬件加速:
<div class="scale-150 transform-gpu"> <!-- ... --></div>如果您需要有条件地撤销此状态,可以使用 transform-cpu 工具将其强制切换回 CPU。
使用 transform-none 工具可以一次性移除元素上的所有变换:
<div class="skew-y-3 md:transform-none"> <!-- ... --></div>Use the transform-[<value>] syntax to set the transform based on a completely custom value:
<div class="transform-[matrix(1,2,3,4,5,6)] ..."> <!-- ... --></div>For CSS variables, you can also use the transform-(<custom-property>) syntax:
<div class="transform-(--my-transform) ..."> <!-- ... --></div>This is just a shorthand for transform-[var(<custom-property>)] that adds the var() function for you automatically.