问题描述
我正在尝试使用 use_percentages
生成具有按百分比显示背景位置的图像精灵.但是编译SCSS文件后,background-position
声明还是以像素为单位.
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.
我的 SASS 代码:
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?
推荐答案
在指定 use-percentages
参数时,您必须在变量中包含精灵图的名称,就像您已经完成的那样用于 layout
.因此,只需将 $use-percentages: true;
更改为 $sprite-use-percentages: true;
.
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;
.
这篇关于如何使用“使用百分比"在指南针上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!