Skip to content
This repository has been archived by the owner on Feb 15, 2020. It is now read-only.

Add guidance for Nested Properties #50

Closed
maya opened this issue Oct 2, 2015 · 1 comment
Closed

Add guidance for Nested Properties #50

maya opened this issue Oct 2, 2015 · 1 comment

Comments

@maya
Copy link
Contributor

maya commented Oct 2, 2015

We should add guidance on Sass nested properties.

Currently we encourage using shorthand only when all values are stated. See Property-value pairs: https://pages.18f.gov/frontend/css-coding-styleguide/format/

With Sass, we can also use Nested Properties.

CSS has quite a few properties that are in namespaces for instance, font-family, font-size, and font-weight are all in the font namespace. In CSS, if you want to set a bunch of properties in the same namespace, you have to type it out each time. Sass provides a shortcut for this: just write the namespace once, then nest each of the sub-properties within it. For example:

.18f {
  margin: {
    top: 2em;
    bottom: 1em;
  }
}
.funky {
  font: {
    family: fantasy;
    size: 30em;
    weight: bold;
  }
}

Do we encourage one over the other? Or just let people know both options are available?

@maya
Copy link
Contributor Author

maya commented Dec 17, 2015

Sounds like we do not want to nest properties and favor writing them out fully.

@maya maya closed this as completed Dec 17, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant