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

What does display none mean in css

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

Editor to share with you what the meaning of display none in css, I believe that most people do not know much, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to understand it!

First of all, let's take a look at what display none means.

What display:none means:

Hide the element and break away from the document, the flow is to hide the area, does not occupy the actual space, but for the background, you can get the hidden element is simply set to none when the element will not occupy space, nor can be displayed, equivalent to the element does not exist.

After reading the meaning of display none, let's go on to look at the usage of display none.

The usage of display none:

Let's look directly at an example of display:none:

one

two

three

four

five

six

seven

eight

nine

ten

eleven

twelve

thirteen

fourteen

fifteen

sixteen

seventeen

eighteen

nineteen

Div {

Background: lightblue

Width: 200px

Height: 200px

}

Span {

Background: pink

Display: none

}

Areas that need to be hidden

If span does not set the value of display:none attribute in the above code, the effect is as follows:

When the display:none property value is set, it becomes the effect shown in the following figure: the area that needs to be hidden is hidden.

One thing to pay attention to when using display:none is:

1. If the display:none style of an element is set through a style file or css, setting style.display= "" with js does not make the element display, but can use block or inline equivalent instead. Settings made directly on the element through the style= "display:none" do not have this problem.

2, if the style file or page file code to hide the element directly with display:none, after loading the page, without setting the style through js to make the element display under the premise, using js code will not be able to correctly obtain some of the element's attributes, such as offSetTop,offSetLeft, etc., the value returned will be 0, through js to set style.display to make the element display before these values can be correctly obtained.

The above is all the content of this article "what is the meaning of display none in css?" Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

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