【问题标题】:CSS selector: Is there a way to select every descendent except the first element?CSS 选择器:有没有办法选择除第一个元素之外的所有后代?
【发布时间】:2020-08-03 17:45:12
【问题描述】:

我的 HTML 看起来像这样:

<div class="passage">
  <header>a bunch of stuff and elements here</header>
  text
  <div/>
  text
</div>

是否有一个 CSS 选择器可以让我选择段落中的所有内容,不包括标题?在这个例子中,它会给我这个:

  text
  <div/>
  text

【问题讨论】:

标签: css testing css-selectors automated-tests testcafe


【解决方案1】:

尝试给你的标题一个类 例如:

<header class="header">a bunch of stuff and elements here</header>

然后尝试选择段落中没有类 .header 的所有元素:

.passage *:not(.header) {...}

【讨论】:

    猜你喜欢
    • 2010-09-15
    • 1970-01-01
    • 1970-01-01
    • 2015-05-01
    • 1970-01-01
    • 1970-01-01
    • 2013-05-22
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多