I have a problem with horizontal centering sprites using Compass Sprites.
I have a bunch of sprites of different sizes for the icons, and I want them to focus on the container in which they are located, so for example, this is the left side icon.
If I do this:
$sprite-position: 50%; @import "sprite/*.png";
then the images are centered on the generated sprite.png, but the CSS is actually something like:
background-position: -9px -223px;
not expected:
background-position: 50% -223px;
What is the point of centering it on a sprite if it has such a location, specially declared in this way? Right now, I hardcode it as 50%, and the Y axis sucks, because when I add a new sprite, I have to change them all, which completely defeats the target.
Am I doing this wrong in Compass, CSS, or just not working as intended? The only way to make sure that this is done is to specify the dimensions, and then contain the icon and center it inside. 50% of the left value remains, so you donβt need to do this ... right?
Just a note ... it sucks that Compass also doesn't support JPEG sprites. - About 6 advertising images were displayed on the first page, and it would be nice if they asked where you can simply replace the images in the folder and sort it!
Thanks Dom
source share