html - 如何使用 :not() 的 css first-child

标签 html css css-selectors

<分区>

有一个 divid = "cooldiv"。它里面有很多 div 元素。现在我需要为所有子 div-s 设置一个 css 属性,第一个除外。

因此,这是我迄今为止为完成此任务所做的尝试:

#cooldiv .row:not(first-child) {
    top: -50px;
}

但是,当然,它没有成功。这里出了什么问题?这是源代码的截图:

enter image description here

最佳答案

试试 #cooldiv .row:not(:first-child)。您似乎在 first-child 之前错过了 :。也许这就是它不起作用的原因?

关于html - 如何使用 :not() 的 css first-child,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43279368/

相关文章:

css - 父项中只有一个子项时的选择器

javascript - 如何在 HTML 的下拉列表中设置条件?

php - 如何在PHP中的导航栏中添加动画

html - Bootstrap 4 测试版 : Options Menu has double dropdown icons

CSS 左右拆分页脚

html - 设计页面的 CSS 技巧

html - 选择 tr 系列的最后一个元素

css - 我可以使用 CSS :hover to effect another elements properties?

javascript - (event.Target === document.getElementById ("id")) 返回 false,即使它们指向同一元素

jquery - 如何应用CSS动画而不刷新