What is the difference between using Z-index: - 1 and display: none to control the effect of hidden elements on page rendering performance?
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.
If the number is not very large, the impact on performance is very small
Z-index is wrong to control invisibility. It's usually a discussion display:none And V isibility:hidden The difference between
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