DEV Community

Discussion on: If you could start over from scratch, how would CSS work?

Collapse
 
booligoosh profile image
Ethan • Edited

Here are the two things I'd change:

1: GET RID OF THE DEFAULT USER AGENT STYLESHEET!!! (mostly)

That was only useful back in the 90's when barely any websites had CSS, nowadays it's just not really very useful and hinders developers more than it helps them. Or, make disabling it as simple as this:

* {
    default-styles: none;
}

NOTE: Obviously keeping some default styling such as hiding <script> tags ;) ;)

2: Better ways to handle !important

You know when there's an element where you really want to say !important !important, because you've already needed to override something in a more specific selector? I think it would be good if you could treat importance like z-index, so you could give it a number - eg. !important(1) or !important(5).

What do you think about those ideas? I'd be interested to know.

Collapse
 
thesdev profile image
Samir Saeedi

About #1, do you know about * { all : unset; }? MDN Link

Collapse
 
booligoosh profile image
Ethan

No I did not!!! Thanks for letting me know about that 😁

Collapse
 
doubleedesign profile image
Leesa Ward

If you need !important that much, something is probably wrong and you need to refactor your CSS.

Collapse
 
booligoosh profile image
Ethan

I don't use !important much, but having specific control over importance would make CSS more flexible