css - :last-child does not select the last element

标签 css css-selectors

<分区>

我想删除最后一个 figure 元素的背景:

@media (min-width: 50em) {
  #mission #press figure {
    padding-left: 0;
    background: url('/assets/img/splash-green.png?1345829368') no-repeat 50% bottom;
  }
  #mission #press figure:last-child {
    background: none;
  }
}

背景仍然显示。我定位有误吗?

最佳答案

我认为您实际上可能正在寻找 last-of-type 而不是 last-child 的功能。

LINK

关于css - :last-child does not select the last element,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12115255/

相关文章:

css - 内联样式与 !important 样式

HTML5 音频播放器在移动设备上调整大小

javascript - 使伪元素出现,然后在 X 时间后再次消失

css - 除了第一个 child 之外的所有东西

html - 如何在我的案例中创建多种背景颜色?

css - 盒子模型混淆 - 表格元素内表单输入字段的边框/填充?

css - 用最大宽度替换宽度

javascript - jQuery :contains full word

html - 如何通过在 css 中使用前后选择器在菜单选项卡上生成绿色复选标记?

css - 可以选择第 2 列并为第 2 列的奇数行添加背景色吗?