The goal of the survey is to help anticipate future CSS trends, and the data is also used by browser vendors to inform their roadmap.
But it’s fun to speculate. So today, let’s take a look at some CSS features that might one day make their way to the browser… or not!
A major trend in recent years — not only in CSS but in society at large — has been recognizing that we’ve often done a poor job of serving the needs of a diverse population. In terms of web development, this translates into building websites that can adapt not only to different devices and contexts but also to different temporary or permanent disabilities such as color blindness or motion sickness.
While the initial proposal focuses on testing
available-inline-size as a way to set up grid layouts, one can imagine the same
switch syntax being used for many other scenarios as well, as a complement to media and container queries.
It’s common in Sass to write loops when you want to style a large number of items based on their position in the DOM. For example, to progressively indent each successive item in a list, you could do the following:
This would then generate the equivalent of 10 CSS declarations. The obvious downside here is that you end up with ten lines of code! Also, what if your list has more than ten elements?
It’s an elegant solution to a common need!
The big problem with this, though, is that neither SVG nor Canvas are really responsive. You can scale them down proportionally, but you can’t have the same fine-grained control that something like CSS Grid offers.
The problem here becomes that once you go past simple blocky bar charts, you need to use a lot of hacks and complex CSS code to achieve what you want. It can work, and libraries like
Charts.css do help a lot, but it’s not easy by any means.
That’s why I think having native chart elements in the browser could be amazing. Maybe something like:
You would then be able to control the chart’s spacing, layout, colors, and so on by using good old CSS — including media and container queries, to make your charts look good in every situation.
Of course, this is something that’s already possible through web components, and many are experimenting in this direction. But you can’t beat the simplicity of pure HTML/CSS.
Here are a couple more quick ones just to keep you on your toes:
This is a bit like
:has() lets you select based on styles and not just DOM properties and attributes, which, now that I think about it, might be another cool feature too!
What if you could target grid items based on their position in a grid or flexbox layout, either by styling a specific row or column or even by targeting a specific item via its
It might seem like a niche use case at first, but as we use Grid and Subgrid more and more, we might also need new ways of targeting specific grid items.
Styling form inputs has traditionally been such a pain that many UI libraries decide to abstract away the native form input completely and recreate it from scratch using a bunch of
divs. As you might imagine, while this might result in nicer-looking forms, it usually comes at the cost of accessibility.
We’ve all run into this: you want to animate an element’s height from
0 to, well, however big it needs to be to show its contents, and that’s when you realize CSS doesn’t let you animate or transition to
Now let’s be real for a second: the chances of any of these features being implemented (let alone supported in all major browsers) are slim, at least if we’re looking at the next couple of years.
But then again, people thought the same about
:has() or native CSS nesting, and it does look like we’re well on our way to being able to use those two — and many more — in our code sooner than later.
Thanks to Lea Verou and Bramus Van Damme for their help with this article.