如何编写CSS选择器来选择不具有特定属性的元素? [英] How to write a CSS Selector selecting elements NOT having a certain attribute?

查看:118
本文介绍了如何编写CSS选择器来选择不具有特定属性的元素?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何编写CSS选择器以选择不具有特定属性的元素?

How to write a CSS Selector selecting elements NOT having a certain attribute?

我有2个< div> 节点,如下所示:

I have 2 <div> nodes as follows:

  • 第一个:

  • First:

<div class="weEq5" style="will-change; width;">
    <button class="_35EW6">

  • 第二个:

  • Second:

    <div class="weEq5">
        <button class="_35EW6">
    

  • 我需要选择< div> (具有相似的类),并且每个都有类似的 descending < button> ,但没有 style 属性.

    I need to select the <div> (with the similar class) and each of them which have a similar descending <button> but without the style attribute.

    XPath 似乎可以正常工作,

    //div[@class and not (@style)]/button
    

    我正在寻找等效的 CssSelector .

    试用:

    div[class :not(style)]>button (doesn't works).
    

    我已经通过以下讨论,但是他们似乎正在将 class 属性作为:not([class])丢弃,如下所示:

    I have been through the following discussion but they seem to be discarding the class attribute as :not([class]) as in:

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆