Skip to content

Instantly share code, notes, and snippets.

@AllThingsSmitty
Created June 18, 2014 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AllThingsSmitty/5a6953739c2cfd03dd3c to your computer and use it in GitHub Desktop.
Save AllThingsSmitty/5a6953739c2cfd03dd3c to your computer and use it in GitHub Desktop.
Very simple and pragmatic mixin for applying hover and active states in one go
// When we give an element some 'attention'
@mixin attention() {
&:hover,
&:active,
&:focus {
@content;
}
}
a {
font-weight: bold;
text-decoration: none;
color: #c00;
@include attention() {
outline: none;
color: #09f;
}
}
.btn {
background-color: #09f;
@include attention() {
background-color: darken(#09f, 10%);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment