Skip to content

Transform Perspective

Set 3D perspective on container (apply to parent of transformed elements)

Syntax

visual="perspective:[value]"

Values

ValueCSS OutputDescription
noneperspective: noneNo perspective
dramaticperspective: 100pxDramatic perspective
nearperspective: 300pxNear perspective
normalperspective: 500pxNormal perspective
midrangeperspective: 800pxMidrange perspective
farperspective: 1000pxFar perspective
distantperspective: 1200pxDistant perspective

Examples

html
<div visual="perspective:normal"><div visual="rotate-y:45">3D rotated</div></div>

Preview

3D Perspective

visual="perspective:normal" - Control 3D depth perception - apply to parent, transform children

dramatic
3D
normal
3D
far
3D
View Code
html
<div layout="flex" space="g:big p:medium" visual="bg:neutral-100 dark:bg:neutral-900 rounded:medium">
  <div layout="flex:col" space="g:tiny">
    <span visual="text:neutral-500 text-size:tiny">dramatic</span>
    <div space="p:medium" visual="perspective:dramatic">
      <div space="p:small" visual="bg:primary text:white rounded:small rotate-y:45">3D</div>
    </div>
  </div>
  <div layout="flex:col" space="g:tiny">
    <span visual="text:neutral-500 text-size:tiny">normal</span>
    <div space="p:medium" visual="perspective:normal">
      <div space="p:small" visual="bg:success text:white rounded:small rotate-y:45">3D</div>
    </div>
  </div>
  <div layout="flex:col" space="g:tiny">
    <span visual="text:neutral-500 text-size:tiny">far</span>
    <div space="p:medium" visual="perspective:far">
      <div space="p:small" visual="bg:warning text:black rounded:small rotate-y:45">3D</div>
    </div>
  </div>
</div>

Arbitrary Values

Supports custom values using bracket syntax:

html
<div visual="transform:[custom-value]">Custom</div>