Skip to content

Instantly share code, notes, and snippets.

@khoand0000
Last active December 25, 2015 09:05
Show Gist options
  • Save khoand0000/9bfb5baf71c6138a87e1 to your computer and use it in GitHub Desktop.
Save khoand0000/9bfb5baf71c6138a87e1 to your computer and use it in GitHub Desktop.
css naming conventions

Main reference: http://thesassway.com/advanced/modular-css-naming-conventions. I don't like BEM because I like lowercase and dashed in css

  • Objects traditionally are nouns. They take the form of:
.noun {}            // examples: .button, .menu, .textbox, .header
  • Parent-Child relationships are also nouns:
.noun {}            // parent: .post
.noun-noun {}       // child:  .post-title
  • To use the Plural Parent Patern, simply pluralize the name of the parent object (the container). Here it is in action for marking up a group of tabs
.tabs {} // parent
.tab {} // child
  • Subclasses are often preceeded by a adjective describing the type of object:
.adjective-noun {}  // example: .dropdown-button
  • And Modifiers are almost always adjectives (or are used descriptively):
.is-state {}        // state: is-selected, is-hidden
.adjective {}       // examples: .left, .right, .block, .inline

Ref:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment