- From: Benny Hinrichs via GitHub <sysbot+gh@w3.org>
- Date: Thu, 09 Apr 2020 00:30:33 +0000
- To: public-css-archive@w3.org
@dvoytenko Just to clarify, specificity of properties is a 5-dimensional value: `[important, inline, id, class, tag]` where any value to the left supersedes any value to the right. See https://cssspecificity.com/. If I have an inline rule of `style="background:black!important"` that gives me a specificity of `[1, 1, 0, 0, 0]`. This supersedes a stylesheet rule of `.container{background:black!important}`, which has specificity of `[1, 0, 0, 1, 0]`. My proposal—and of course it could be altered—is to give a way to freely manipulate the first member of the specificity set. Right now it has binary functionality, with only `0` and `1` as possibilities. If you want to override an `!important`, you currently have to do it by increasing selector complexity. If the `!important` is in an inline style, increasing selector complexity won't work. You have to manipulate the inline style. If you don't have source access, you have to use JavaScript to manipulate that node. I used the word `specificity` in the OP, but perhaps a better way to imagine it would be if it just used `important`. Then our rule above could be `.container{background:black!important(2)}`, and that rule would win over the inline rule with specificity of `[2, 0, 0, 1, 0]`. -- GitHub Notification of comment by BennyHinrichs Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/3890#issuecomment-611262429 using your GitHub account
Received on Thursday, 9 April 2020 00:30:36 UTC