Performance differences between visibility:hidden and display:none

前端 未结 8 1031
一生所求
一生所求 2020-11-27 04:34

I want to simplify things in my jQuery Backbone.js web application. One such simplification is the behavior of my menu and dialog widgets.

Previously I created the

相关标签:
8条回答
  • 2020-11-27 05:00

    Well, visibility:none still uses the space of the div. So you could maybe skip the positioning part because its place is already allocated (and by that get a better performance).

    But I somehow guess that you need your display:none approach to allocate space correctly when the "show" event is triggered.

    0 讨论(0)
  • 2020-11-27 05:06

    display:none; elements are not in the render tree all, so they will perform better at face value.

    I doubt you will have any real visible performance problems from this though. If you need opacity: 0 or visibility: hidden because of their functionality, then just use them. If you don't need the functionality, then use display: none;

    0 讨论(0)
提交回复
热议问题