What is the difference between visibility:hidden and display:none?

前端 未结 18 1967
余生分开走
余生分开走 2020-11-21 04:50

The CSS rules visibility:hidden and display:none both result in the element not being visible. Are these synonyms?

18条回答
  •  孤城傲影
    2020-11-21 05:32

    If visibility property set to "hidden", the browser will still take space on the page for the content even though it's invisible.
    But when we set an object to "display:none", the browser does not allocate space on the page for its content.

    Example:

    Content not display on screen and even space not taken.
    Content not display on screen but it will take space on screen.

    View details

提交回复
热议问题