Is there a selector to exclude display: none elements?

前端 未结 6 2086
醉话见心
醉话见心 2021-02-19 23:22

I want to select only whose parents have display: block and exclude those whose parents have display

6条回答
  •  闹比i
    闹比i (楼主)
    2021-02-20 00:01

    Actually there's a CSS3 solution to select elements that doesn't have a display:none style, or given an explicit style property:

    *:not([style*="display: none"]) button{ ... }
    

    Demo:

    *:not([style*="display: none"]) button{
        color:yellow;
    }

    My name is A.

提交回复
热议问题