How to use “use-percentages” on Compass?

假如想象 提交于 2019-12-13 06:28:05

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!