undefinedfix
Sign in

What is the difference between using Z-index: - 1 and display: none to control the effect of hidden elements on page rendering performance?

eeeeeen edited in Sun, 01 May 2022

What is the difference between using Z-index: - 1 and display: none to control the effect of hidden elements on page rendering performance?

4 Replies
suxbr
commented on Sun, 01 May 2022

When did Z-index become an attribute of a hidden element, just put it behind the screen, but still visible (in the case of no other element blocking). The events above will not be triggered.

nunomira
commented on Sun, 01 May 2022

If the number is not very large, the impact on performance is very small

IrQus
commented on Mon, 02 May 2022

Z-index is wrong to control invisibility. It's usually a discussion display:none And V isibility:hidden The difference between

Storca
commented on Mon, 02 May 2022

z- index:-1 It's not hidden, it's just that the hierarchy is blocked, which makes it invisible. display:none Is hidden, but only not displayed on the page, does not take up space isibility:hidden The corresponding DOM will occupy the corresponding space

lock This question has been locked and the reply function has been disabled.