如何在compas sass中生成精灵位置,例如“右-300px”?
我发现sass只能输出数字的背景位置,但有时我需要精灵位置右对齐或下对齐,怎么做?
请在下面查看我的代码:
<style type="text/css">
/* ------- scss ------- */
$map_btn: sprite-map("sprite_btn/*.png");
.btn,.btn span{
display:inline-block;
background-image: sprite-url($map_btn);
background-repeat: no-repeat;
}
.go_to_cart{
background-position: sprite-position($map_btn,go_to_cart);
span{
background-position: sprite-position($map_btn,go_to_cart);
}
}
/* ------- output ------- */
.btn,.btn span{
display:inline-block;
background-image: url('../images/btn_sprite.png');
background-repeat: no-repeat;
}
.go_to_cart{
background-position: 0 -300px;
}
.go_to_cart span{
background-position: 0 -330px;
/* -------
but I want to output like this bellow:
how to write in scss?
------- */
background-position: right -330px;
}
</style>
<a href="#" class="btn go_to_cart">
<span></span>
</a>