Skip to content
CSS Transforms

Quick tip: transform-origin for tilted planes

Rotate around the right corner and half the maths goes away.

The classic CSS recipe is rotateX(60deg) followed by rotateZ(-45deg). The first rotation tips the square away from you; the second turns it so its corners point up and down. Together they give the familiar diamond. Swap the order and you get something else entirely, because transforms apply from right to left, which catches almost everyone at least once.

What you built

  • A cube with three shaded faces
  • A floor grid from gradients
  • A hover state that lifts the block
Share

Written by

Inês Duarte

Inês is Cubefold's colour and type lead. She believes every isometric scene needs exactly one warm accent, and not two.

All 16 posts by Inês Duarte

8 comments

  1. Farah Aziz

    Love the palette. Could you share the exact lightness values?

    Reply to Farah Aziz
    1. Gus Lindgren

      Yes, container queries work well; we will cover them soon.

      Reply to Gus Lindgren
    2. Inês DuarteAuthor

      Glad it helped. The values are in the colour ratios reference.

      Reply to Inês Duarte
  2. Tess Walsh

    Works nicely in Firefox. Safari needed the prefixed transform-style for us.

    Reply to Tess Walsh
  3. Bea Kowalski

    This finally made the order of rotations click for me. I had them the wrong way round for weeks.

    Reply to Bea Kowalski
  4. June Park

    Short and useful. More quick tips like this, please.

    Reply to June Park
  5. Soren Dahl

    Tiny typo in the second code block: the unit is missing on the translate value.

    Reply to Soren Dahl
  6. Eli Novak

    Our designer drew the scene in Figma and I rebuilt it with your approach in an afternoon.

    Reply to Eli Novak

Leave a comment

Your email address won’t be published. Required fields are marked.