CSS Wish list for 2025
CSS (Cascading Style Sheets - a web technology to those that don't know), is having a bit of a golden period. I still remember the days when this technology seamed to move at snails pace. Now not a week goes past when I discover some new feature has been released into the wild.
This could be oklch()
color functions or scroll-snap
or any one of the other things I find when tying to do some kind of task with my current project. Any opportunity to replace a node module with native behavior, and learn something new about the technology I've spent the past 20 years of my life playing with, is always welcome.
For this year 2025 I would like to see two things added to CSS.
1 - currentBackground
I would love to see a currentBackground
keyword - which would work just like currentColor
in that it inherits the background colour of a parent element. I can see this being handy for things like ghost buttons and things like that.
2- random()
A random()
function - which could take one or two arguments, or even an array of things and returns a random result. Could be very useful for randomizing the colour of things, you could pass in a hue value and it spits out a random colour for you. This function could also be especially useful when combined with animations.
After posting about my desire for a random()
function on Mastodon - the esteemed Eric Meyer mentioned that random()
has been proposed to the World Wide Web Consortium (W3C). So that's one down and one to go.