- OOCSS is the preferred methodology (Object-Oriented CSS)
- Classes should be in recursive alphabetical order
- Childs of a class should come after the parent class itself
- Only the direct parent class should be written in selector:
.class {
/* Some styles */
}
.class .childclass {
/* Some styles */
}
-
only 2 "
parent child
" pair can be in selector -
Selecting html tags are only allowed when there are no scoped tags:
<div class="class">
<h1>Heading</h1>
<p>Paragraph</p>
</div>
<!-- you can select `.class h1` and `.class p` here -->
-
Ordering for a style group:
- Class
- Pseudo-elements
- Pseudo-classes
-
Order of pseudo-elements:
- before
- after
- first-line
- first-letter
- selection
- marker
-
Order of pseudo-classes:
- hover
- click
-
Order of properties:
.class {
/* Margin and padding */
/* Display (Flex, grid, etc.) */
/* Background */
/* Shadows */
}