Last active
December 18, 2015 00:39
-
-
Save shirokuro331/5698477 to your computer and use it in GitHub Desktop.
Retina 対応 mixin
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
$spriteName: sprite-map("folder/*.png", $spacing: 5px); | |
@mixin sprite-hoge($name){ | |
background-image: $spriteName; | |
background-repeat: no-repeat; | |
width: image-width(sprite-file($spriteName, $name)) / 2; | |
height: image-height(sprite-file($spriteName, $name)) / 2; | |
$ypos: round(nth(sprite-position($spriteName, $name), 2) / 2); | |
background-position: 0 $ypos; | |
background-size: round(image-width(sprite-path($spriteName)) / 2) round(image-height(sprite-path($spriteName)) / 2); | |
} | |
.no1{ | |
@include sprite-hoge($name); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
round ってのは四捨五入らしい。
http://kanapple.net/study/archives/17