Skip to content

Instantly share code, notes, and snippets.

@shirokuro331

shirokuro331/gist:5698477

Last active Dec 18, 2015
Embed
What would you like to do?
Retina 対応 mixin
$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);
}
@shirokuro331

This comment has been minimized.

Copy link
Owner Author

@shirokuro331 shirokuro331 commented Jun 3, 2013

round ってのは四捨五入らしい。
http://kanapple.net/study/archives/17

@shirokuro331

This comment has been minimized.

@shirokuro331

This comment has been minimized.

Copy link
Owner Author

@shirokuro331 shirokuro331 commented Jun 4, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.