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

前端 未结 18 1628
余生分开走
余生分开走 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:41

    They're not synonyms - display: none removes the element from the flow of the page, and rest of the page flows as if it weren't there.

    visibility: hidden hides the element from view but not the page flow, leaving space for it on the page.

提交回复
热议问题