DEV Community

Cover image for DISCUSS: If there's one CSS feature you could add, what would it be?
Thalita G.
Thalita G.

Posted on • Updated on

DISCUSS: If there's one CSS feature you could add, what would it be?

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!


Thalita logo

Twitter | Website

Top comments (8)

Collapse
 
jmdejager profile image
🐤🥇 Jasper de Jager

A parent selector

.myClass < span { display: block }

Collapse
 
thalitadev profile image
Thalita G.

Gosh, the many situations where I wished there was a parent selector! 🙃

Collapse
 
afif profile image
Temani Afif

it does exist: drafts.csswg.org/selectors-4/#rela... but we still need to wait too long for a tiny support

Collapse
 
alohci profile image
Nicholas Stimpson • Edited

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.

Thread Thread
 
jmdejager profile image
🐤🥇 Jasper de Jager

But if I was a wizard.. 🧙‍♂️✨ 😊

Collapse
 
alohci profile image
Nicholas Stimpson • Edited
  1. attr() on all properties and on regular elements would be great.
  2. There was some great ideas in the 2003 Generated and Replaced Content draft, like ::outside pseudo element, ::before::before::before etc pseudo elements, deferring rendering with an ::alternate pseudo element. Wish we had those.
  3. If we can't have 2, then content:contents would be very helpful.
  4. CSS regions
  5. CSS exclusions.

Oops, that's five features. Just being greedy :-)

Collapse
 
thalitadev profile image
Thalita G.

Getting attr() on all properties would be absolutely great! If I had to pick one of these, it'd be most definitely that one! :)

Collapse
 
thalitadev profile image
Thalita G.

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!