Is there an opposite to display:none?

后端 未结 15 1750
夕颜
夕颜 2020-12-22 19:47

The opposite of visibility: hidden is visibility: visible. Similarly, is there any opposite for display: none?

Many people be

15条回答
  •  余生分开走
    2020-12-22 19:59

    display: none doesn’t have a literal opposite like visibility:hidden does.

    The visibility property decides whether an element is visible or not. It therefore has two states (visible and hidden), which are opposite to each other.

    The display property, however, decides what layout rules an element will follow. There are several different kinds of rules for how elements will lay themselves out in CSS, so there are several different values (block, inline, inline-block etc — see the documentation for these values here ).

    display:none removes an element from the page layout entirely, as if it wasn’t there.

    All other values for display cause the element to be a part of the page, so in a sense they’re all opposite to display:none.

    But there isn’t one value that’s the direct converse of display:none - just like there's no one hair style that's the opposite of "bald".

提交回复
热议问题