Skip to content
Tutorials

Reference: CSS custom properties we use

Every variable in our tutorials and what it controls.

SVG is often the better choice for complex scenes. CSS cubes are fun to build and easy to animate, but a city block made of hundreds of divs is hard to change and heavy to render. We draw the static parts in SVG, keep the interactive blocks in CSS, and layer the two together.

At a glance

Engine support
Feature Chrome Firefox Safari
preserve-3d Yes Yes Yes
backface-visibility Yes Yes Prefixed in old versions
individual transform properties Yes Yes Yes

Scaling for small screens

Typography on a tilted plane is readable only in small doses. A single word on the side of a block looks great; a paragraph set at an angle is exhausting. Keep running text flat and upright, and save the skewed type for labels, numbers and the occasional headline where the shape of the word matters more than speed.

Stacking order is the part that trips people up. In a flat layout, later elements paint on top. In a tilted scene, a block that is further back must paint first, even if it appears later in the markup. Either sort your markup by depth or give each block a z-index derived from its row and column.

Download

cubefold-grid-templates.zipIsometric grid backgrounds in CSS and SVG. 610 B
Download cubefold-grid-templates.zip

Questions

Is isometric art accessible?

Decorative art is fine when hidden from assistive technology. Informative art needs a text alternative.

How many cubes are too many?

Once the Layers panel shows more than about forty layers, flatten the static parts into SVG.

Why does my cube look flat?

Something on an ancestor, such as overflow: hidden or a filter, is flattening the 3D context.

Which angle should I use?

Use true isometric for CSS and the 2:1 ratio for pixel art. Readers will not notice the difference.

Share

Written by

Mara Lindqvist

Mara draws isometric city blocks in CSS and edits the Isometric Basics column. She once rebuilt a subway map using nothing but borders.

All 13 posts by Mara Lindqvist

11 comments

  1. Gus Lindgren

    Great write-up. Would love a follow-up on doing the same thing with SVG.

    Reply to Gus Lindgren
  2. Omar Haddad

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

    Reply to Omar Haddad
    1. Lena Vogel

      Thanks! A follow-up is already in the drafts.

      Reply to Lena Vogel
  3. Dana Ortiz

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

    Reply to Dana Ortiz
  4. Bea Kowalski

    Is there a way to do the shadow without a pseudo-element? Our CMS strips empty spans.

    Reply to Bea Kowalski
  5. Hana Sato

    The paper cube exercise sounds fun. Are the templates available somewhere?

    Reply to Hana Sato
  6. Kofi Mensah

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

    Reply to Kofi Mensah
  7. Soren Dahl

    The part about layer counts was eye-opening. Our landing page had over a hundred.

    Reply to Soren Dahl
    1. June Park

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

      Reply to June Park
  8. Pia Jensen

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

    Reply to Pia Jensen
    1. Ivo Petrov

      The templates are in the downloads section of the reference post.

      Reply to Ivo Petrov

Leave a comment

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