Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Naming Conventions


Use dash-cased class names

  • It's consistent with CSS property naming convention
.some-class-name {}

Do not use ID's for styling

  • ID's are not modular and quickly run into specifity issues
  • It's better to leave them for JS identifiers, and only use class names for styling

Namespace all class names to avoid collisions

  • Usually company initials
.ns-sidebar {}

Namespace with module prefix

.ns-admin-sidebar {}

Use HTML hierarchy when possible

.ns-admin-sidebar > header {}

No cascading (?)

No overriding (?)

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