Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to make elements invisible by html

2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

Editor to share with you how html sets the elements invisible. I hope you will get something after reading this article. Let's discuss it together.

Html sets the element invisible method: 1, add the hidden attribute in the element tag; 2, use the style attribute to set the "display:none" style in the element tag; 3, use the style attribute to set the "visibility:hidden" style in the element tag.

The operating environment of this tutorial: windows7 system, HTML5 version, Dell G3 computer.

There are three ways to make elements invisible in html:

Use the hidden property

Use the style property to set display:none

Use the style property to set visibility:false

Obviously, there are two ways to make elements invisible:

The element is completely invisible, the element will not occupy space, as if it had disappeared

The element is invisible, but it still occupies the original space, as if invisible

Use the hidden property

Hello

The effect of using the hidden attribute is to automatically change the element's display attribute to none when you render the DOM. Note that the only use of the hidden attribute is here: change display to none only the first time you add the hidden attribute. In the future, even if the display attribute becomes the block,hidden attribute, it will still be there.

It can be seen that hidden and display=none have the same effect. But not as direct and fundamental as display. Therefore, instead of using the hidden property in the future, access the display property in the style directly.

Use the style property to set display:none

Display=none in style can make an element disappear completely, without a trace, without taking up space.

Hello

Use the style property to set visibility=hidden

In the case of visibility=hidden in style, the element seems to be invisible, but still occupies the original space.

Hello has finished reading this article, I believe you have some understanding of "how to set elements invisible in html". If you want to know more about it, welcome to follow the industry information channel. Thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report