Skip to content

Instantly share code, notes, and snippets.

@GabeStah
Created December 11, 2015 06:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GabeStah/0a317104ee5360837cde to your computer and use it in GitHub Desktop.
Save GabeStah/0a317104ee5360837cde to your computer and use it in GitHub Desktop.
Use Element/Class Selectors
/* Use Element/Class Selectors */
/* Bad, 'nav' tag unnecessary and selecting by ID is limiting */
nav#home-button {}
/* Better, selecting by class name is ideal, but the nav tag is still unnecessary */
nav.menu-button {}
/* Best, we can select only the class name and reuse the rule elsewhere if needed.
Alternatively, we can also simply select the nav element only. */
.menu-button {}
nav {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment