- Object Oriented CSS
- SMACSS
- BEM
- DRY CSS
- Atomic CSS
- Flexibility
- Maintainability
- Performance
- Scalable
Modular = reusable code
consider this patterns as guidelines rather than absolute rules
- Based in OOP but not quite
- Abstract design patterns into blocks
- Encourage modular code for faster, efficient, and easier to maintain
- Separte structure and skin
- Separate container and content
Abstract similar boxes with a class
#box-1 {
border: 1px solid black;
border-radius: 5px
}
#box-2 {
border: 1px solid black;
border-radius: 5px
}
.box-border{
border: 1px solid black;
border-radius: 5px
}
- Avoids IDs
- Lack of duplication reduces size of CSS files and HTML
- A way to examine your design process
- Encourages classes
- IDs are appropriate even if used less often
- Goal: increase the semantic value of a section of HTML
- Goal: decrease the expectation of a pecific HTML structure
- Base: applied directly to element selectors (resets)
- Layout: rules for mayor components (header)
- Module: live inside layout (repeated navigation)
- State Theme:
- Encourages reorganization of the selectors to avoid classes
- Keep style separte form content
- Avoid specificity by harnessing the cascade
- Selectors and definitios should be as global as possible
- approach to CSS architecture that favors small, single-purpose classes with names based on visual function.