una.im | Updates to the customizable select API
It’s great to see the evolution of HTML happening in response to real use-cases—the turbo-charging of the select
element just gets better and better!
A terrific tour of just some of the fantastic ways you can use :has()
in CSS.
The section on using it with sibling selectors blew my mind:
How often have you wanted to adjust the margins on a headline based on the element following it? Now it’s easy. This code allows us to select any h2 with a p immediately after it.
h2:has(+ p) { margin-bottom: 0; }
Amazing.
It’s great to see the evolution of HTML happening in response to real use-cases—the turbo-charging of the select
element just gets better and better!
Anselm isn’t talking about becoming a CSS wizard, but simply having an understanding of what CSS can do. I have had similar experiences to this:
In the past years I had various situations where TypeScript developers (they called themselves) approached me and asked whether I could help them out with CSS. I expected to solve a complex problem but for me — knowing CSS very well — it was always a simple, straightforward solution or code snippet.
Let’s face it, “full stack” usually means “JavaScript”—HTML and CSS aren’t considered worthy of consideration. Their loss.
I like the approach here: logical properties and sensible default type and spacing.
Picture me holding Trys back and telling him, “Leave it alone, mate, it’s not worth it!”
This is a very handy piece of work by Rich:
The idea is to set sensible typographic defaults for use on prose (a column of text), making particular use of the font features provided by OpenType. The main principle is that it can be used as starting point for all projects, so doesn’t include design-specific aspects such as font choice, type scale or layout (including how you might like to set the line-length).
If you’re going to toggle the display of content with CSS, make sure the more complex selector does the hiding, not the showing.
Improving performance with containment.
Separate your concerns.
Browsers and bugs.
Styling a document about The Culture novels of Iain M Banks.