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

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

    There is a big difference when it comes to child nodes. For example: If you have a parent div and a nested child div. So if you write like this:

    
    

    In this case none of the divs will be visible. But if you write like this:

    
    

    Then the child div will be visible whereas the parent div will not be shown.

提交回复
热议问题