Is there an opposite to display:none?

后端 未结 15 1712
夕颜
夕颜 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 20:17

    A true opposite to display: none there is not (yet).

    But display: unset is very close and works in most cases.

    From MDN (Mozilla Developer Network):

    The unset CSS keyword is the combination of the initial and inherit keywords. Like these two other CSS-wide keywords, it can be applied to any CSS property, including the CSS shorthand all. This keyword resets the property to its inherited value if it inherits from its parent or to its initial value if not. In other words, it behaves like the inherit keyword in the first case and like the initial keyword in the second case.

    (source: https://developer.mozilla.org/docs/Web/CSS/unset)

    Note also that display: revert is currently being developed. See MDN for details.

提交回复
热议问题