任何人都知道如何实现第二个选择器 (.resource-list li a[data-type="XXX"]) 的优先级高于第一个 (.resource-list[data-type="XXX"] li a )? 不重新排列 CSS?
.resource-list[data-type="jpg"] li a,
.resource-list li a[data-type="jpg"] /* This should have the highest priority */ {
background-image: url(jpg.png);
}
.resource-list[data-type="pdf"] li a,
.resource-list li a[data-type="pdf"] /* This should have the highest priority */ {
background-image: url(pdf.png);
}
见小提琴:http: //jsfiddle.net/8bG2j/