Thoughts on CSS in 2024
Published on July 15, 2024 (⻠July 29, 2024), filed under Development (RSS feed for all categories).
I havenât written about CSS in a while đŹ (Instead, a new book about HTML optimization, some comments about veganism, and other random things.) Am I still alive? Yes! đ (You can feel my heartbeat over at Frontend Dogma!)
So what are these thoughts, about CSS, in 2024? Let me keep it light and casual.
What I Appreciate
There are a few things I appreciate. These things arenât necessarily what everyone else may be hyped up aboutâthough they donât exactly go unnoticed, either.
What I appreciate deeply, given how long and how much Iâve missed that power, are all 86 * of todayâs selectors. (Iâve explained a little in CSS: :has()
and the Lost Paradigm.)
If you had me pick three selectors I particularly appreciate, Iâd choose :has()
, :not()
, and is:()
(over :where()
, because I usually like the added specificity).
Sure, there are other things I appreciate, like grid or container queries, but the reason why Iâm so selector-focused is that selectors have a direct impact on HTML code quality. â Whatâs in a style sheet is far less important than how the HTML looks likeâwith separation of concerns, we can swap that out in an instant. (You know all of this, but this is such a misunderstood biggie, I have to hold myself back here!)
Favorites
I have some favorites, too.
Iâve found myself to set scroll-behavior: smooth
in most every new project. (It made quite a difference on the Worldâs Highest/Longest Website!)
I really like text-wrap: pretty
, which had me dial down on the hyphens
property and which obsoleted both tooling and habits around fine-tuning typography by setting no-break spaces.
Itâs old, but I also like ::selection
, which shouldâcouldâprobably be used by more websites and apps.
There are a few things Iâm monitoring, like ::target-text
, but thatâs not there yet.
That list may seem short, but thereâs surely a reason for this: Other âbread and butterâ properties and declarations are even older, and donât feel like favorites because of their ubiquity. Yet others are so individual, i.e., project-specific, that I couldnât call them favorites, either.
What I Donât Need
Thereâs a lot that I donât need from contemporary CSS.
Though not a âfeatureâ of CSS, I donât use resets, and never have. As Iâve written about resets in the past, I wonât do so now. One angle that I havenât played in the past, however, is to ask how we could have any projects without resets (which exist), if resets are so critical. I donât think this point has ever been appreciated by reset proponents.
I donât use logical properties (except for axis shorthands, like margin-block
). Iâve written about logical properties, too. Having worked on bi-directional projects, I know about their value (if I worked on any such project now, Iâd absolutely use logical properties)âbut experience working on international sites is what makes me be clear about when theyâre not needed. (Thereâs more here, sure, but this point of need also lacks appreciation.)
I use custom properties, but rarely. Theyâve proven their value, but that value is limited when keeping style sheets DRY. Using declarations just once works. I know the field rushed past this, but boy, it does this all the time (hi Conditional Comments, AMP, and yes, resets).
There are more things I donât need and use, but well, thatâs the beauty of web developmentâwe donât have to use it all. (Itâs good to keep an eye on whatâs becoming available though.)
⧠This must be a somewhat strange look at CSS, in 2024. And yet, covering CSS pretty much all the time, I know this also adds perspective. Selectors could use more recognition. Favorites differ wildly. And we usually seem to write about what we need and want, not what we donât need and want. (If you are explicit about your not-needs, email me so that I feature your perspective on Frontend Dogma!)
* Thatâs the number I have in my upcoming book, to learn-by-memorizing (yes!) HTML and CSS!
â This needs explanation insofar as the range of impact goes from dictating HTML attributes (like classes), values (like class names), and even structure (like styling-related containers) to not affecting the HTML markup at all. Quality-wise, this then maps to potentially highly negatively impacting HTML quality (increased payload, decreased maintainability) to not impacting it at all (the highest level).
About Me
Iâm Jens (long: Jens Oliver Meiert), and Iâm a frontend engineering leader and tech author/publisher. Iâve worked as a technical lead for companies like Google and as an engineering manager for companies like Miro, Iâm somewhat close to W3C and WHATWG, and I write and review books for OâReilly and Frontend Dogma.
I love trying things, not only in web development (and engineering management), but also in other areas like philosophy. Here on meiert.com I share some of my views and experiences.
If youâd like to do me a favor, interpret charitably (I speak three languages, and they do collide), yet be critical and give feedback, so that I can make improvements. Thank you!
Read More
Maybe of interest to you, too:
- Next: On Title Case
- Previous: Transitive Optimization ConsideredâInteresting
- More under Development
- More from 2024
- Most popular posts
Looking for a way to comment? Comments have been disabled, unfortunately.
Get a good look at web development? Try WebGlossary.infoâand The Web Development Glossary 3K (2023). With explanations and definitions for thousands of terms of web development, web design, and related fields, building on Wikipedia as well as MDN Web Docs. Available at Apple Books, Kobo, Google Play Books, and Leanpub.