Methods to hide elements:
(Recommended learning:css quick start)
- ##display :none hides the corresponding element and no longer allocates space to it in the document flow. The elements on all sides will be closed but the resources will be loaded and the DOM can be accessed.
- Visibility: hidden Hide the corresponding element, but retain the original space in the document flow, and the resource will be loaded.
- opacity: 0 Can be clicked, takes up space, and can be used.
The difference between methods: display will generate redraw reflow, visibility:hidden only redraws, display:none nodes and descendant nodes are not visible, visibility:hidden descendant nodes can be set visibility:visible display.
The above is the detailed content of What are the ways to hide elements in css? What's the difference?. For more information, please follow other related articles on the PHP Chinese website!