Chris Coyier on

What is safe alignment in CSS?

Stefan Judis covered this recently, and like Stefan, I first heard of the safe keyword in CSS from Rachel Andrews at an AEA conference years ago. It’s used in addition to other alignment keywords in layout like this for example: The extra value safe here is essentially saying “don’t let the alignment force a situation […]

Chris Coyier on

Modern Font Stacks

Just a little appreciation for Dan Klammer’s Modern Font Stacks project. Not loading any custom fonts doesn’t need to mean being relegated to the Helvetica/Arial hole, system fonts (even though I do kinda love San Francisco), or some bummer typeface you feel pushed into. I particularly like the Geometric Humanist stack:

Chris Coyier on

CSS :has() Interactive Guide

You know I’m a little obsessed with :has() in CSS and how useful it is. So I’m chuffed that Ahmad Shadeed made a killer interactive guide with loads of great examples. The basics are so satisfying like “Does this <figure> have a <figcaption>? Yes? OK then style it differently.” And that can be leveled up […]

Chris Coyier on

The Fifty-Fifty Split and Overflow

A left-and-right layout is blissfully easy with CSS grid. Something like grid-auto-rows: 1fr; will do it — just put two elements as the children. This is how I like to roll though, making two equal columns that can shrink properly: But Ryan Mulligan found a very interesting way to make it complicated in The Fifty-Fifty […]

Ollie Williams on

Menus, toasts and more with the Popover API, the dialog element, invokers, anchor positioning and @starting-style

Dropdowns, menus, tooltips, comboboxes, toasts — the popover attribute will make building a large variety of UI components easier. The popover attribute can be used on any HTML element, so you have the flexibility to choose whichever element is most appropriate semantically for each particular use case. Unlike a dialog, a popover is always non-modal […]

Chris Coyier on

Okay, Color Spaces

Eric Portis did a bang up job explaining color spaces on the web. sRGB is, as Eric puts it “the web’s dominant, default color space”, but he doesn’t spend much time on that. Thanks to recent evolutions in web tech, we have access to a wider gamut of colors (P3) and more color spaces than […]

Chris Coyier on

View transitions: Handling aspect ratio changes

Jake Archibald has some great examples of awkward gotchas with View Transitions. View Transitions are naturally great at tweening one state of a DOM element to the next, but you’ll see likely-unwanted ghosting if the element changes shape from one state to the next. You can either prevent it from changing shape by changing either […]