CSS tips from Style That DOM

The Cascade

One technique per post, with a live example and the CSS behind it.

  1. Style the parent with :has()

    CSS finally lets an element react to what's inside it. No JavaScript, no toggled classes.

  2. Center anything with place-items

    Two lines of CSS to center a child both ways, and why grid beats the old tricks.