无法指向此选择器

时间:2012-01-15 17:30:01

标签: html css css-selectors

我有一个看起来像这样的div

<div class="listItem jrFeatured">

我希望它保留listItem的所有CSS,但为jrFeatured添加其他CSS

但我不希望所有jrFeatured仅与listItem

中的{{1}}不同

我真的误解了这个,还是有办法实现我的目标?

1 个答案:

答案 0 :(得分:4)

.listItem {
    /* code for item(s) matching listItem class */
}

.jrFeatured {
    /* code for item(s) matching jrFeatured class */
}

.listItem.jrFeatured {
    /* code for item(s) matching BOTH listItem and jrFeatured classes */
    /* based on your question, this sounds like what you're looking for */
}