Tidy code is a sacrosant and everybody knows that. But how to get down to it? Frotunately, somebody has already asked that question before. The implementation of CSS naming convention for classes is the answer. Here you have an introduction to BEM methodology.
9. Blocks can be nested and interact with each
other, semantically they remain equal;
there is no precedence or hierarchy.
10. Block names may consist of lowercase
Latin letters, digits, and dashes. Individual
words within names are separated by a
dash.
.block
11. Block name should identify block and say
what it is responsible for. The block name
replaces IDs.
12. Element is parts of a block and have no
standalone meaning. They are
semantically tied to its block.
13. Element names may consist of Latin
letters, digits, dashes and underscores.
CSS class is formed as block name plus
two underscores plus element name.
.block__element
14. Modifier are flags on blocks or elements.
Use them to change appearance or
behavior.
15. Modifier names may consist of Latin
letters, digits, dashes and underscores.
CSS class is formed as block’s or
element’s name plus two dashes.
.block__element——modifier
20. no dependencies on other elements
reduce cascading problems reduce
amount of CSS code create ready blocks
library simple and understandable
structure in CSS and HTML code Sass
loves BEM drop tag names and IDs
21. long class names which could look’s
weird develop the habit to properly name
class modular thinking