我有几个用于评级系统的 css Sprite :http://i.imgur.com/qeb2b.png
加载缩略图时
.thumb-down {
background: url('http://i.imgur.com/qeb2b.png') no-repeat -126px -13px;
width: 15px;
height: 16px;
}
.thumb-up {
background: url('http://i.imgur.com/qeb2b.png') no-repeat -126px -33px;
width: 15px;
height: 16px;
}
让大拇指出现的唯一方法是这样做:
Was this review helpful? <a href="#" class="thumb-up rating"> </a> | <a href="#" class="thumb-down rating"> </a>
如果我删除所有
然后大拇指消失了。如果我只留下一个
然后它显示 Sprite 的局部 View 。
如何在不需要 ?
的情况下显示 Sprite ?
最佳答案
通过使用float:left
:
.thumb-down {
background: url('http://i.imgur.com/qeb2b.png') no-repeat -126px -13px;
width: 15px;
height: 16px;
float: left; /* OR float:right, depending on what you need */
}
.thumb-up {
background: url('http://i.imgur.com/qeb2b.png') no-repeat -126px -33px;
width: 15px;
height: 16px;
float: left;
}
关于除非 <a 有空格,否则 css 不显示图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10879027/