Created
February 21, 2013 13:33
-
-
Save krisbulman/5004754 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com, the Sass playground.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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; | |
// } | |
// } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.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