Skip to content

Instantly share code, notes, and snippets.

@krisbulman
Created February 21, 2013 13:33
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 krisbulman/5004754 to your computer and use it in GitHub Desktop.
Save krisbulman/5004754 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com, the Sass playground.
// Sass v3.2.5
// Sass v3.2.5
// Answer to: How can I do this without typing "background-position" and "14px" twice?
// https://www.facebook.com/groups/SassyCSS/
// because you're using vanilla sass, and not a sprite engine like that provided by compass,
// then you can't use the magic of magic selectos. Instead you would have to create a mixin
// to reduce repeatable code, in the example I have created, you would be relying on a static
// offset of 100, however you could also throw that in as an argument if the value varied.
@mixin spriting-position($offset-x, $offset-y) {
background-position: $offset-x $offset-y;
&:hover{
$hover-offset-x: $offset-x + 100;
background-position: $hover-offset-x $offset-y;
}
}
.hotel-filter-sprite-Spa {
@include spriting-position(-1927px, 14px);
}
// .hotel-filter-sprite-Spa {
// background-position: -1927px 14px;
// &:hover{
// background-position: -1827px 14px;
// }
// }
.hotel-filter-sprite-Spa {
background-position: -1927px 14px;
}
.hotel-filter-sprite-Spa:hover {
background-position: -1827px 14px;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment