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

Rely on CSS inheritance #6

Open
oliverjam opened this issue Jul 10, 2020 · 0 comments
Open

Rely on CSS inheritance #6

oliverjam opened this issue Jul 10, 2020 · 0 comments

Comments

@oliverjam
Copy link

oliverjam commented Jul 10, 2020

Lots of CSS properties are inherited. This means if an element's parent has that property set the element will also use it. This is useful for default stuff you want to set once but apply to everything, like font styles.

You can set font-family, size etc on the body, and everything else will inherit those styles. This avoids having to either explicitly set font styles on different elements, or target every element with *.

One caveat: form elements like buttons don't inherit font styles by default. You can reset this to make them consistent like this:

button {
  font: inherit;
}
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

No branches or pull requests

1 participant