CSS has gone a very long way from being a simple stylesheet to something more dynamic. Think of calc() and CSS variables. They haven't turned CSS into a programming language, but they sure are helpful!
But there's still a lot that could be added to CSS! Now, imagine you were a wizard who possesses the entire W3 team and whoever works on our browsers... 🧙♂️✨
✍ Comment below answering the following question
If there was one CSS feature you could add that gets instantly supported by all major browsers, what would it be?
This can be a new feature or something that's already in W3 but isn't supported yet. It also doesn't have to be a property, you can think about functions as well. The possibilities are endless!
Top comments (8)
A parent selector
.myClass < span { display: block }
Gosh, the many situations where I wished there was a parent selector! 🙃
it does exist: drafts.csswg.org/selectors-4/#rela... but we still need to wait too long for a tiny support
The problem with a has() selector, according to Tab Atkins, is that means that any DOM mutation will cause the cascade for the entire document to have to be rebuilt, which is much too slow. There's some suggestions that a has-child() selector might be possible, but it still increases the sub-tree that needs its cascade rebuilt from everything under the mutated element's parent, to everything under the mutated element's grandparent, which may still be regarded as too great. So don't hold your breath waiting for support.
But if I was a wizard.. 🧙♂️✨ 😊
Oops, that's five features. Just being greedy :-)
Getting attr() on all properties would be absolutely great! If I had to pick one of these, it'd be most definitely that one! :)
Hmm, that's a very interesting one! 😮☝ Not sure about using Js in CSS, but CSS could use some kinda programming logic, like what Sass has!