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 a contributor to several web standards, 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 experiences and views. (Please be critical, interpret charitably, and giveĀ feedback.)
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. 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.