Last active
August 29, 2015 14:15
-
-
Save jasonkmccoy/293b391b99243839477c to your computer and use it in GitHub Desktop.
Sass Nesting: Sass Bites Podcast #9
This file contains hidden or 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
/* CSS Output */ | |
ul { | |
list-style: none; | |
font-size: 16px; | |
line-height: 1.6; | |
} | |
a { | |
text-decoration: none; | |
color: pink; | |
} | |
a:hover { | |
color: white; | |
} | |
.active { | |
color: black; | |
} | |
/* Example #1: Simple Nesting */ | |
.menu { | |
background: green; | |
} | |
.menu .menu__ul { | |
padding: 20px; | |
} | |
.menu .menu__ul--li { | |
display: inline; | |
padding: 10px; | |
text-decoration: none; | |
} | |
/* Example #2: @media nesting */ | |
.menu { | |
background: green; | |
} | |
.menu .menu__ul { | |
padding: 20px; | |
} | |
.menu .menu__ul--li { | |
padding: 10px; | |
text-decoration: none; | |
} | |
@media (max-width: 468px) { | |
.menu .menu__ul--li { | |
display: block; | |
} | |
} | |
@media (min-width: 469px) { | |
.menu .menu__ul--li { | |
display: inline; | |
} | |
} |
This file contains hidden or 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
<!-- HTML code --> | |
<div class="menu"> | |
<ul class="menu__ul"> | |
<li class="menu__ul--li"><a href="#" class="active">Home</a></li> | |
<li class="menu__ul--li"><a href="#">About</a></li> | |
<li class="menu__ul--li"><a href="#">Blog</a></li> | |
<li class="menu__ul--li"><a href="#">Contact</a></li> | |
</ul> | |
</div> |
This file contains hidden or 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
/* Sass code */ | |
// General styles | |
ul | |
list-style: none | |
font-size: 16px | |
line-height: 1.6 | |
a | |
text-decoration: none | |
color: pink | |
&:hover | |
color: white | |
.active | |
color: black | |
/* Example #1: Simple Nesting */ | |
// Try to only go 3 levels deep | |
.menu | |
background: green | |
.menu__ul | |
padding: 20px | |
.menu__ul--li | |
display: inline | |
padding: 10px | |
text-decoration: none | |
/* Example #2: @media nesting */ | |
.menu | |
background: green | |
.menu__ul | |
padding: 20px | |
.menu__ul--li | |
padding: 10px | |
text-decoration: none | |
@media (max-width: 468px) | |
display: block | |
@media (min-width: 469px) | |
display: inline | |
This file contains hidden or 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
/* SCSS code */ | |
// General styles | |
ul { | |
list-style: none; | |
font-size: 16px; | |
line-height: 1.6; | |
} | |
a { | |
text-decoration: none; | |
color: pink; | |
&:hover { | |
color: white; | |
} | |
} | |
.active { | |
color: black; | |
} | |
/* Example #1: Simple Nesting */ | |
// Try to only go 3 levels deep | |
.menu { | |
background: green; | |
.menu__ul { | |
padding: 20px; | |
} | |
.menu__ul--li { | |
display: inline; | |
padding: 10px; | |
text-decoration: none; | |
} | |
} | |
/* Example #2: @media nesting */ | |
.menu { | |
background: green; | |
.menu__ul { | |
padding: 20px; | |
} | |
.menu__ul--li { | |
padding: 10px; | |
text-decoration: none; | |
@media (max-width: 468px) { | |
display: block; | |
} | |
@media (min-width: 469px) { | |
display: inline; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sass Bites Podcast #9: Sass Nesting
https://www.youtube.com/watch?v=tGd9c4knERw
https://www.youtube.com/user/sassbites