.offbeat {background-position: x y }
.active .offbeat {background-position: x y }
因为在事件状态下我想改变图像的位置。
在我的案例中选择了主动均值
最佳答案
对于样式,只需添加事件类 -
<div class="offbeat active">Some Content</div>
如果您使用的是 jQuery -
$('.offbeat').click(function(){
$(this).toggleClass('active')
});
并改变图片的背景位置——
.active{
background-position: x y; /*New Position*/
}
不要用另类继承active类
尝试添加 -
.offbeat:active{...............}
不知道 compass ,但这就是 CSS 的工作原理!
关于css - 如何以这种方式在 Compass 中获取 css sprite 类?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11078767/