-
-
Save GabeStah/0a317104ee5360837cde to your computer and use it in GitHub Desktop.
Use Element/Class Selectors
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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