This guide is loosely based on SMACSS.
Use Hyphen Delimited Strings to name CSS class because it is consistent with the CSS property names.
Bake name-space into CSS class names where possible / appropriate to avoid conflict.
Bad: .title{...}
Good: .portfolio-title{...}
Use 2-spaces for indentation not 4-spaces.
There are 3 possible locations for a CSS class / style to be placed.
location: ./css/base.css
Base contains default values for base elements like body and h1 as well as other style rules that apply to the whole app.
For example:
body {
overflow-y: scroll;
overflow-x: hidden;
}
location: ./css/layout.css
Layout contains style rules that define containers and other layout elements, that control how the various components of the app fit together.
For example:
.container-primary {
background-color: #fafafa;
border-radius: 10px;
filter: drop-shadow(0px 2px 8px rgba(0, 0, 0, 0.15));
padding: 30px;
margin: 15px;
overflow: hidden;
}