Closed nuxodin closed 3 years ago
What's the benefit of lower specificity? I don't see how anyone would care to override this.
If you want to override tab-size for a specific element, for example a custom element, :root
wins.
:root {
tab-size: 4;
}
custom-pre { /* does not overwrite */
tab-size: 3;
}
I don't see any reason to use :root.
And you save one byte :)
From the original issue (https://github.com/sindresorhus/modern-normalize/issues/17):
Using :root so users can easily override it on a per-element basis.
Either I was confused back then or we're missing something now.
My wisdom comes from here: https://css-tricks.com/a-complete-guide-to-custom-properties/#the-root-thing
And it makes sense, :root
is a pseudo class and has 0.1.0
specificity where html
has 0.0.1
change :root to html because
:root
has a higher specificity thanhtml