Skip to content

Instantly share code, notes, and snippets.

@SylarRuby
Last active September 4, 2017 21:30
Show Gist options
  • Save SylarRuby/20795df837cabe0ac0275c6420f2ad9b to your computer and use it in GitHub Desktop.
Save SylarRuby/20795df837cabe0ac0275c6420f2ad9b to your computer and use it in GitHub Desktop.
BEM SASS Demo
/*
* .navbar is the name of our component
*
*/
.navbar {
height: 90px;
// .navbar__container
&__container {
display: flex;
align-items: center;
justify-content: space-between;
// We could vertical align this.
}
// We could have nested below inside "&__container", but
// I do not ususally go that deep
&__container__logo {
text-align: left;
// Now I will go deep
&--svg {
// your style for logo
}
}
&__container__links {
text-align: right;
&--home {
// style for a.navbar__container__links--home
}
}
// Media Queries
@media all and (max-width: 768px) {
// We are already inside our ".navbar" element
&__container {
flex-direction: column;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment