Home>Article>Web Front-end> What are the ways to hide elements in css? What's the difference?

What are the ways to hide elements in css? What's the difference?

王林
王林 forward
2020-07-13 16:49:46 3088browse

What are the ways to hide elements in css? What's the difference?

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!

Statement:
This article is reproduced at:csdn.net. If there is any infringement, please contact admin@php.cn delete