--- layout: post title: "Moduler CSS" date: 2016-01-07 categories: CSS --- Four popular methods for writing modular HTML and CSS.
  1. Object Oriented CSS (OOCSS)
  2. Scalable and Modular Architecture for CSS (SMACSS)

    The five categories it defines are: Base, Layout, Module, State and Theme.

    Another important concept to SMACSS is its naming convention. As Snook mentions, “a naming convention is beneficial for immediately understanding which category a particular style belongs to and its role within the overall scope of the page.” The following convention is suggested for each of the four core categories: Base Nothing needed Layout l- or layout- prefix State is- prefix, as in is-active or is-hidden. When applied to a module, you should include the module name as in .is-tab-active Module Modules just use module name (.box) instead of trying to prefix each. However, related modules (submodules) receive a consistent prefix to help organise them (.box-border, .box-background, etc)

  3. Don’t Repeat Yourself CSS (DRY CSS)
  4. Block, Element, Modifier (BEM)