Skip to content
Grid Systems

Screencast: CSS grid for tile layouts

Placing tiles with grid areas instead of absolute positions.

Custom properties make isometric CSS far easier to maintain. Instead of hard-coding sizes, we define a single unit on the scene wrapper and multiply it everywhere else. Changing the unit rescales the whole illustration, keeps the proportions intact and means a phone layout needs one media query instead of twenty.

A quick review before shipping

Isometric drawing keeps every parallel line parallel. There is no horizon and no vanishing point, so a block at the back of the scene is exactly as large as one at the front. That sounds like a limitation, but it is the reason the style works so well for diagrams: you can measure anything, compare anything, and line things up without fighting perspective.

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.

Game artists have a name for the pixel-art version of isometric: two-to-one. Lines climb one pixel for every two across, which gives clean, stair-stepped edges instead of jagged ones. The angle is about 26.6 degrees rather than 30, and almost nobody notices, which is a nice reminder that looking right beats being exact.

We keep every demo in a small repository with one folder per post. Each folder has the HTML, the CSS and a short note on what we tried and dropped. Months later, when a reader asks why a tutorial does something a certain way, the note usually has the answer and saves us a long investigation.

Tile engines figured out draw order decades ago. Sort by the sum of the column and row, draw from the smallest sum to the largest, and most scenes just work. Tall objects that span several tiles need special care, but the simple rule covers floors, walls and small props, which is most of what a blog illustration needs.

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

8 comments

  1. Gus Lindgren

    Has anyone tried this with container queries? Feels like a good fit.

    Reply to Gus Lindgren
  2. Mateo Rossi

    Bookmarked. The table alone is worth it.

    Reply to Mateo Rossi
  3. Hana Sato

    I tried this on an old iPad and one of the faces flickers on hover. Any idea why?

    Reply to Hana Sato
    1. Mara LindqvistAuthor

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

      Reply to Mara Lindqvist
  4. Pia Jensen

    I teach an intro CSS class and I am going to use this as the final project.

    Reply to Pia Jensen
  5. Rosa Medina

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

    Reply to Rosa Medina
    1. Bea Kowalski

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

      Reply to Bea Kowalski
  6. Dana Ortiz

    How would you handle text that needs to wrap on one of the faces?

    Reply to Dana Ortiz

Leave a comment

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