Created
February 18, 2015 20:26
-
-
Save jasonkmccoy/02a37d296950169fd526 to your computer and use it in GitHub Desktop.
Sass Variables: Sass Bites Podcast #10
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 */ | |
/* Example #1 */ | |
.blog { | |
color: #555; | |
background: tan; | |
width: 800px; | |
height: auto; | |
} | |
.blog__article { | |
font-size: 1.2rem; | |
padding: 20px; | |
} | |
.blog__article--link { | |
border-bottom: 1px dashed green; | |
font-size: 1.44rem; | |
color: maroon; | |
text-decoration: none; | |
} | |
.blog__article--link:hover { | |
color: white; | |
} | |
/* Example #2: Micah */ | |
.widget-title { | |
padding: 0 2em; | |
} | |
.widget-picture { | |
padding-left: 1em; | |
} |
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="blog"> | |
<article class="blog__article"> | |
This is some text for a blog article. Here is a <a href="#" class="blog__article--link">link</a> for an image. | |
Blah blah blah blah blah. Blah blah blah blah blah blah blah. Blah blah blah blah blah blah. Blah blah blah. | |
</article> | |
</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 */ | |
// @import a link to your variables in the future | |
// i.e. partials/_variables.sass | |
// instead of having your variables here | |
// Variables must start with a $ | |
// You CAN overwrite variables | |
$primary-bg: tan | |
$primary-color: #555 | |
$default-font-size: 1.2rem | |
$gutter: 20px | |
$blog-link: maroon | |
$blog-link-hover: white | |
$primary-border: 1px dashed green | |
/* Example #1 */ | |
.blog | |
color: $primary-color | |
background: $primary-bg | |
width: 800px | |
height: auto | |
.blog__article | |
font-size: $default-font-size | |
padding: $gutter | |
.blog__article--link | |
border-bottom: $primary-border | |
font-size: $default-font-size * 1.2 | |
color: $blog-link | |
text-decoration: none | |
&:hover | |
color: $blog-link-hover | |
/* Example #2: Micah */ | |
$widget-padding: 2em | |
$widget-class: picture | |
$direction: left | |
.widget-title | |
padding: 0 $widget-padding | |
.widget-#{$widget-class} | |
padding-#{$direction}: $widget-padding/2 | |
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 */ | |
// @import a link to your variables in the future | |
// i.e. partials/_variables.sass | |
// instead of having your variables here | |
// Variables must start with a $ | |
// You CAN overwrite variables | |
$primary-bg: tan; | |
$primary-color: #555; | |
$default-font-size: 1.2rem; | |
$gutter: 20px; | |
$blog-link: maroon; | |
$blog-link-hover: white; | |
$primary-border: 1px dashed green; | |
/* Example #1 */ | |
.blog { | |
color: $primary-color; | |
background: $primary-bg; | |
width: 800px; | |
height: auto; | |
} | |
.blog__article { | |
font-size: $default-font-size; | |
padding: $gutter; | |
} | |
.blog__article--link { | |
border-bottom: $primary-border; | |
font-size: $default-font-size * 1.2; | |
color: $blog-link; | |
text-decoration: none; | |
&:hover { | |
color: $blog-link-hover; | |
} | |
} | |
/* Example #2: Micah */ | |
$widget-padding: 2em; | |
$widget-class: picture; | |
$direction: left; | |
.widget-title { | |
padding: 0 $widget-padding; | |
} | |
.widget-#{$widget-class} { | |
padding-#{$direction}: $widget-padding / 2; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sass Bites Podcast #10: Sass Variables
https://www.youtube.com/watch?v=U9hSPSNu73Q
https://www.youtube.com/user/sassbites