Skip to content

Instantly share code, notes, and snippets.

@csswizardry
Last active August 29, 2015 14:16
Show Gist options
  • Select an option

  • Save csswizardry/41cddd95ec8f9e58decc to your computer and use it in GitHub Desktop.

Select an option

Save csswizardry/41cddd95ec8f9e58decc to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
<div id="box">
<a href="#0" class="btn">Pellentesque</a>
</div>
// ----
// Sass (v3.4.12)
// Compass (v1.0.3)
// ----
//[id="box"], // Use an attribute selector to reduce specificity.
#box {
padding: 1em;
background-color: #e4e4e4;
&,
a {
color: #333;
}
}
.btn {
display: inline-block;
padding: 0.5em;
background-color: #333;
color: #fff; // Yikes! Gets overridden by `.box a {}`.
// Chain the class with itself to bump up its specificity!
//&#{&} {
// color: #fff;
//}
}
#box {
padding: 1em;
background-color: #e4e4e4;
}
#box,
#box a {
color: #333;
}
.btn {
display: inline-block;
padding: 0.5em;
background-color: #333;
color: #fff;
}
<div id="box">
<a href="#0" class="btn">Pellentesque</a>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment