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 use CSS3 selector

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

Most people don't understand the knowledge points of this article "how to use CSS3 selector", so Xiaobian summarizes the following contents for everyone. The contents are detailed, the steps are clear, and they have certain reference value. I hope everyone can gain something after reading this article. Let's take a look at this article "how to use CSS3 selector".

First let's see what displaynone means.

Display:None means:

Hidden elements and out of the document, flow is to hide the area, does not occupy the actual space, but for the background is real existence, you can get hidden elements Simple is to set the element to none when neither occupied space nor can be displayed, equivalent to the element does not exist.

Having seen the meaning of displaynone, let's move on to the use of displaynone.

DisplayNone Usage:

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

div{

background:lightblue;

width:200px;

height:200px;

}

span{

background:pink;

display:none;

}

Areas to hide

If span is not set in the above code, the display:none attribute value is set

If you set the display:none attribute value, the effect will be as shown below: the area that needs to be hidden will be hidden.

Use display:none to note:

1. If the display:none style of an element is set by style file or css, setting style.display="" with js does not make the element display, and block or inline equivalents can be used instead. Settings made directly on elements via style="display:none" do not have this problem.

2. If the element is hidden directly with display:none in the style file or page file code, after loading the page, under the premise that the element is not displayed by js setting style, js code will not be able to correctly obtain some attributes of the element, such as offSetTop,offSetLeft, etc. The returned value will be 0. These values can only be obtained correctly after js setting style.display to display the element. A selector, to put it bluntly, is a way to select elements. We've covered this in detail in the "What is CSS Selector" section of the CSS Starter tutorial.

CSS3 adds a lot of useful selectors to CSS2.1, which makes the way we manipulate HTML elements more flexible and convenient.

CSS3 adds 3 categories of selectors:

(1) attribute selector;

(2) structural pseudo-class selector;

(3) UI element state pseudo-class selector

The above is the content of this article about "how to use CSS3 selector". I believe everyone has a certain understanding. I hope the content shared by Xiaobian will be helpful to everyone. If you want to know more relevant knowledge, please pay attention to 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