html - 无法定位此选择器

标签 html css css-selectors

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

<div class="listItem jrFeatured">

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

但我不希望所有的 jrFeatured 只与 listItem 中的不同

我真的误解了这一点还是有办法实现我想要的?

最佳答案

.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 */
}

关于html - 无法定位此选择器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8871742/

相关文章:

css - 为什么blueprint css定义一个div.class和class具有相同的样式?

javascript - iframe加载后隐藏链接

javascript - CSS active li 不正确

html - 默认浏览器 CSS 未被覆盖

javascript - jQuery 错误 - 生成未定义

可以缩短多张 CD 的 css 选择器

css - div位置绝对高度不起作用

PHP和Mysql(拉取信息)

jquery - 如何使用 jquery 获取文本框中的复选框标签值

jQuery选择器从特定无序列表中获取li对象