CSS Standards
File Formatting
CSS filenames must be named using underscores (_) to demarcate new words
Naming Conventions
Separate words in CSS selectors should be demarcated with hyphens (e.g. .main-container).
Coding Style
* The unit of indentation is four spaces
* Selectors should be followed by one space, with the opening brace on the same line
* Properties should have one space after the colon
* Closing braces should be on a new line
* A metric value of 0 should be represented as 0 rather than 0px, 0em, etc.
* Textual representations of colors should be avoided. Use #fff over white
* Short representations of colors should be used if possible. Use #fff over #ffffff
* Lowercase letters should be used for almost every character in a CSS document. The only exception might be selector names and filenames. Otherwise, use lowercase letters for selectors, properties, values, and colors.
- .selector {
- color: #000;
- }
Multiple selectors should be entered on separate lines:
- .selector-1,
- .selector-2,
- .selector-3 {
- display: block;
- }