Skip to content

Instantly share code, notes, and snippets.

@tortillaj
Last active August 29, 2015 14:20
Show Gist options
  • Save tortillaj/3b2a01ee68ee41cec4e2 to your computer and use it in GitHub Desktop.
Save tortillaj/3b2a01ee68ee41cec4e2 to your computer and use it in GitHub Desktop.
Sass Variables
<div>
<h1>This text is red</h1>
<p>Yet paragraphs are blue. <a href="#">Links are blue too.</a></p>
</div>
// ----
// Sass (v3.4.13)
// Compass (v1.0.3)
// ----
// set a global variable
$myColor: blue;
p {
color: $myColor;
}
h1 {
// now you can overwrite $myColor
// as a nested variable here
$myColor: orange;
color: $myColor;
}
a {
color: $myColor;
text-decoration: underline;
}
p {
color: blue;
}
h1 {
color: orange;
}
a {
color: blue;
text-decoration: underline;
}
<div>
<h1>This text is red</h1>
<p>Yet paragraphs are blue. <a href="#">Links are blue too.</a></p>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment