问题
I'm trying to use use_percentages
to generate an image sprite with background position by percentage. But after compiling the SCSS file, the background-position
declaration is still in pixels.
My SASS code:
@import "compass/utilities/sprites";
$sprite-layout:smart;
$sprite-sprite-dimensions: true;
$use-percentages: true;
@import "images/sprite/*.png";
@include all-sprite-sprites;
How can I get the sprite images to be positioned by percentages?
回答1:
You have to include the name of your sprite map in the variable when specifying the use-percentages
parameter, as you have already done for layout
. So just change $use-percentages: true;
to $sprite-use-percentages: true;
.
来源:https://stackoverflow.com/questions/26467557/how-to-use-use-percentages-on-compass