css - 如何仅将 css 规则应用于少数元素

标签 css html

我有以下 css 条目

.plugins-updown .top-panel.plugin header {
    cursor: move;
}

此 CSS 应用于我网站中的许多标题元素。但是在两个标题元素中,我希望将光标设为默认值。所以我只在这两个标题元素中添加了一个新类,如下所示

<div class="top-panel plugin">
<header class="default-cursor">

</header>
</div>

.plugins-updown .top-panel.plugin header .default-cursor {
    cursor: default;
}

但是当我检查 Chrome 的开发工具时,我没有看到 cursor:default 被应用。开发工具的检查元素显示这两个特定的标题元素具有 .default-cursor 类作为其中的一部分,但未应用 css 并且光标显示为 cursor:move 与其他标题元素一样。

谢谢

最佳答案

.default-cursor 选择器连接到它的元素,如下所示:

.plugins-updown .top-panel.plugin header.default-cursor {
    cursor: default;
}

关于css - 如何仅将 css 规则应用于少数元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32150032/

相关文章:

html - 一个带有 AUTO 的 float div,然后是另一个填充其余部分的 div

css - 如何增加 twitter bootstrap 轮播导航箭头的大小

jquery - 将 fading "tooltips"添加到网站

javascript - 使按钮在添加/删除类上消失并重新出现

html - 如何使 UIWebView 链接在 UIPopover 中打开?

html - Firefox css 问题(元素之间不需要的空格)

html - 导航栏菜单下拉菜单不起作用(单击时不会下拉)

html - 子菜单没有完全并排定位

php - 将正确的链接附加到 JSON

html - Rails html 编码