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

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

    display: none removes the element from the page entirely, and the page is built as though the element were not there at all.

    Visibility: hidden leaves the space in the document flow even though you can no longer see it.

    This may or may not make a big difference depending on what you are doing.

提交回复
热议问题