</> Code Corner

CSS · CSS Advanced · Lesson 48

CSS 3D Transforms

rotateX, rotateY and perspective.

CSS supports 3D transformations: rotateX(), rotateY(), rotateZ(), combined with perspective to create depth.

Example

<style>
.scene { perspective: 400px; display: flex; gap: 30px; padding: 20px; }
.card { width: 120px; height: 80px; background: dodgerblue; color: white; display: flex; align-items: center; justify-content: center; font-family: Arial; }
.x { transform: rotateX(50deg); }
.y { transform: rotateY(50deg); }
.z { transform: rotateZ(50deg); }
</style>
<div class="scene">
  <div class="card x">rotateX</div>
  <div class="card y">rotateY</div>
  <div class="card z">rotateZ</div>
</div>

Keep reading “CSS 3D Transforms”

Sign up to read the full lesson, try every example in the live editor, and take the 5-question quiz.

Chat with us 👋