Comment by stevage
2 years ago
Whoa, that's weird. So once there is `!important`, the order of precedence flips? I'm sure there was a good reason for that...
2 years ago
Whoa, that's weird. So once there is `!important`, the order of precedence flips? I'm sure there was a good reason for that...
Your OS had a dark theme, that gets represented in the browser as a not !important user style. The website should be able to override this to avoid the white text on white background problem.
But then if the user is tweaking a specific site, the user should be able to override anything with ! important if they really mean it.
Yeah, I understand that in general.
But what's curious is that normally it goes browser < user < author, but with !important, it flips so that browser > user > author. Specifically the part where the browser now outranks the user style is interesting.
These are (presumably) for things that even user styles are not supposed to be able to "break". Sifting through https://meiert.com/en/blog/user-agent-style-sheets/ shows quite reasonable things such as
in the Firefox UA styles (though I'd permit overriding the former and I'd expect shadow DOM to handle the latter), or
in the Chrome UA style.
I believe the reason is to allow users to override websites.