在scss中,如何定义不同的background-position:值1 值2;

有很多小图标,共用一张大图,再每个小标签定义不同的position位置。现在我想把里面的参数一起写在mixin里,再后面调用,代码如下:

@mixin background($l,$r){

    background-image:url(../style_img/castle_icon6.png);

    background-repeat:no-repeat;

    background-position:$l $r; 

}

em{

    @include background( -100px -200px );

}

i{

      @include background( -50px -30px );

}

参数是这样写的,现在报错了,我只看到课上有讲过定义其中一个参数的用法,我想做的这个没有看到,希望老师能解答这个问题。


qq_李小婷_0
浏览 1564回答 0
0回答
打开App,查看更多内容
随时随地看视频慕课网APP