Using css-layers to easily overwrite styles without using !important

I tried to do some theming using space-styles and I noticed that a lot of the time !important is necessary to override existing styles. Since I heard of css @layers I thought they might be a good solution, although I hadn’t used them until now.

So I decided to give it a try: GitHub - daniel-michel/silverbullet at use-css-layers

This seems to work, although I haven’t tested it thoroughly and it is a very quick and dirty solution. Especially the way I wrap the CodeMirror styles in a layer is not that great, but I could not figure out how those styles are added. Therefore I added a little bit of code that changes the style element: use css layers to reduce the need for !important (especially when usi… · daniel-michel/silverbullet@21046a3 · GitHub

Maybe someone has a better solution?

I have already seen !important being used in some examples. Is this just annoying me or are you all also interested in a solution? And what are your thoughts on this solution?

1 Like