后者使用PNG sprite,如果我是正确的,您的代码来自Twitter BootStrap附带的Glyphicons。
即使标记使用单词图标确实意味着格式或方法与使用标准背景有任何不同,下面是icon-arrow-down使用 CSS 的代码。
.icon-arrow-down {
background-position: -312px -96px;
}
[class^="icon-"], [class*=" icon-"] {
background-image: url("../img/glyphicons-halflings.png");
background-position: 14px 14px;
background-repeat: no-repeat;
display: inline-block;
height: 14px;
line-height: 14px;
margin-top: 1px;
vertical-align: text-top;
width: 14px;
}
如果您想将 sort_asc.png 图像应用到它自己的类而不是表中,那么只需添加如下内容:
.sort-asc {
background: url('images/sort_asc.png') no-repeat center right; }
width:50px;
height:50px;
}