Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it easier to override tab-size #50

Merged
merged 1 commit into from
May 2, 2021
Merged

Make it easier to override tab-size #50

merged 1 commit into from
May 2, 2021

Conversation

nuxodin
Copy link
Contributor

@nuxodin nuxodin commented Apr 27, 2021

change :root to html because :root has a higher specificity than html

change :root to html because `:root` has a higher specificity than `html`
@sindresorhus
Copy link
Owner

What's the benefit of lower specificity? I don't see how anyone would care to override this.

@nuxodin
Copy link
Contributor Author

nuxodin commented Apr 27, 2021

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 :)

@sindresorhus
Copy link
Owner

From the original issue (#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.

@nuxodin
Copy link
Contributor Author

nuxodin commented Apr 28, 2021

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

@sindresorhus sindresorhus changed the title change :root to html Make it easier to override tab-size May 2, 2021
@sindresorhus sindresorhus merged commit 96261e0 into sindresorhus:main May 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants