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

王林
Release: 2020-07-13 16:49:46
forward
3073 people have browsed it

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!

Related labels:
source:csdn.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!