CSS display:none and visibility:hidden

前端 未结 3 425
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-19 03:07

I have a div that I use to display alerts when needed.

If I want to close it after a while can I use display:none or should I use display:none as well as visibility:

3条回答
  •  悲&欢浪女
    2020-12-19 03:17

    Visibility:hidden hides the element but it still takes up space in the layout. Display:none removes it completely.

    In your case, I would use Display:none

提交回复
热议问题