Skip to content

Instantly share code, notes, and snippets.

@pepelsbey
Last active March 1, 2024 11:03
Show Gist options
  • Star 19 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pepelsbey/a2bb3f6b44c4a4729dcc to your computer and use it in GitHub Desktop.
Save pepelsbey/a2bb3f6b44c4a4729dcc to your computer and use it in GitHub Desktop.
Simple “Hocus” Sass @mixin for :hover and :focus pseudos. Makes them easier to write and you’ll never forget to specify both.
@mixin hocus {
&:hover,
&:focus {
@content;
}
}
// Before
E {
&:hover,
&:focus {
color:whatever;
}
}
// After
E {
@include hocus {
color:whatever;
}
}
@rafaelkyrdan
Copy link

Where is button "Like"? :)

@pepelsbey
Copy link
Author

@rafaelkyrdan, there’s star button at the top, use it instead :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment