Home  >  Q&A  >  body text

Show no and: yes

Whether to: React positively or negatively to the display: None. This means if you have an element and nothing is displayed on it, will :has still see that there is one? I think it will, because there's an element there. But I might need to compare it with:

:not([style*="display: none"])

Just confirm behavior

P粉396248578P粉396248578187 days ago303

reply all(2)I'll reply

  • P粉633733146

    P粉6337331462024-04-03 14:56:50

    Because of "display:none", we set the style inline in any code where the element will be hidden.

    
    
    

    1 This is a paragraph.

    2 This is a paragraph.

    reply
    0
  • P粉004287665

    P粉0042876652024-04-03 10:56:45

    display The attribute does not change the behavior of the selector because it does not change the DOM tree, so it will still work

    Like if you have

    Hi

    div:has(p) {
      background: blue;
      padding: 5rem;
    }
    p {
      display: none;
    }

    reply
    0
  • Cancelreply