Skip to content
CSS Transforms

Clamp your cube sizes

clamp() stops a hero cube from swallowing a phone screen.

Icons are the hardest isometric art to get right because there is so little room. At small sizes one of the three faces usually has to go, so we pick the two that best describe the object. A book keeps its cover and spine; a box keeps its top and front. Deciding early saves a lot of redrawing.

Avoid this

Do not animate width or height on transformed blocks. Animate transform instead so the browser can skip layout.

CSS
.floor {	background-image:		repeating-linear-gradient(30deg, var(--line) 0 1px, transparent 1px 40px),		repeating-linear-gradient(150deg, var(--line) 0 1px, transparent 1px 40px);}
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. Rosa Medina

    Any plans for a video version of this one?

    Reply to Rosa Medina
  2. Omar Haddad

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

    Reply to Omar Haddad
  3. Tess Walsh

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

    Reply to Tess Walsh
    1. Quinn Adler

      Good question. Usually that means something is flattening the 3D context; check for overflow hidden on a parent.

      Reply to Quinn Adler
  4. Gus Lindgren

    This is the clearest explanation of draw order I have read.

    Reply to Gus Lindgren
  5. Alex Moreau

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

    Reply to Alex Moreau
    1. Lena Vogel

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

      Reply to Lena Vogel
  6. Pia Jensen

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

    Reply to Pia Jensen

Leave a comment

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