CSS architecture
- BEM(Block Element Modifier https://en.bem.info/methodology)
- SMACSS(Scalable and Modular Architecture for CSS http://smacss.com)
- OOCSS(Object-Oriented CSS: https://github.com/stubbornella/oocss/wiki).
BEM: Block, Element, Modifier
BEM is a component-based architecture that aims to break user interface into independent, reusable blocks.
- Block: An example would be a class for an element, such as
header
- Element: The class name is the block name followed by two underscores and the element, such as
header__menu
. - Modifier: describes the appearance, state and behavior. The class pattern is
blockName_modifierName
(exampleheader_mobile
) orblockName__elementName_modifierName
(exampleheader__menu_open
)
CSS class and HTML tag id pattern is cameralCase
.