Compass sprite background position is not as i want it
compass-sass, css, sass
Solution
You may want to check out this Github Gist: https://gist.github.com/adamlogic/3577147, which has helped me fix spriting issues in the past and also gain a better understanding of how spriting in Compass works.
Of particular interest to you may be the portion where the author mentions the following: (pasted here in case the Gist is removed)
"I took this a bit further by defining my own (sprite) mixin."
$spritemap-spacing: 50px
@import "spritemap/*.png"
=background-sprite($name, $repeat: no-repeat, $offset-x: 0, $offset-y: 0)
background-image: $spritemap-sprites
background-repeat: $repeat
+sprite-background-position($spritemap-sprites, $name, $offset-x, $offset-y)
// if no offsets given, set the dimensions of the element to match the image
@if $offset-x == 0 and $offset-y == 0
+sprite-dimensions($spritemap-sprites, $name)
"and how I'm using it"
// simplest case; sets the background image and dimensions of the element
h3
+background-sprite(ribbonfull)
// custom offset; does not set the dimensions of the element
h2
+background-sprite(ribbonend, no-repeat, 3px, 22px)
// repeating backgrounds are possible, too
#positions
+background-sprite(doubleline, repeat-x, 0, 45px)
And, the author's generated CSS:
h3 {
background-image: url('/images/spritemap-sb826ca2aba.png');
background-repeat: no-repeat;
background-position: 0 -405px;
height: 29px;
width: 295px; }
h2 {
background-image: url('/images/spritemap-sb826ca2aba.png');
background-repeat: no-repeat;
background-position: 3px -296px; }
#positions {
background-image: url('/images/spritemap-sb826ca2aba.png');
background-repeat: repeat-x;
background-position: 0 -751px; }
Problem
I'm first-time using Compass spriting. I wanted to have icons images (all are in little different in sizes) centered position. like the attached image I'm using this setting ``` $icons-spacing:40px; @import "icons/*.png"; @include all-icons-sprites; ``` the css i'm getting is (for example) ``` .icons-adventure { background-position: 0 -608px; } ``` It's not that as I required. I want to give more spacing from top and left.