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 are the CSS3 selectors and how to use them

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

Share

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

Today, the editor will share with you what CSS3 selector has and how to use it. The content is detailed and the logic is clear. I believe most people still know too much about this knowledge, so share this article for your reference. I hope you can get something after reading this article. Let's take a look at it.

In CSS, a decision maker is a kind of content that is used to determine the elements that need to be added.

The "CSS" column indicates in which version of CSS the property is defined. (CSS1, CSS2 CSS3 as usual. )

The decision maker example depicts all the elements of CSS.class.intro 's choice of class= "intro". 1#id#firstname determines all the elements of the id= "firstname". Select all elements. 2elementp decides all

element. 1elementforward elementdivrecoverp Select all elements and all

element. All outside the 1element elementdiv p selection element

element. 1element selector "href=" http://www.w3school.com.cn/cssref/sele CTO r_element_gt.asp "> element > elementdiv > p Select the parent element as all of the element

element. 2element+elementdiv+p is determined to do everything immediately after the element.

element. 2 [attribute] [target] determines all elements with the target attribute. 2 [attribute=value] [target=_blank] Select all elements of target= "_ blank". 2 [attribute~=value] [title~=flower] determines that the title attribute contains all the elements of the word "flower". 2 [attribute | = value] [lang | = en] decides that the value of the lang attribute should be the original all elements of "en". 2:linka:link resolutions are all unvisited links. 1:visiteda:visited decides all the links that have been visited. 1:activea:active resolution activity link. 1:hovera:hover resolves the link over which the mouse pointer is positioned. 1:focusinput:focus is determined to get the core input element. 2:first-letterp:first-letter decided that each

The initials of the element. 1:first-linep:first-line decides that each

The first line of the element. 1:first-childp:first-child selects each of the first child elements that belong to the parent element

element. 2:beforep:before in every

The content of the element has been inserted in the past. 2:afterp:after in every

The content is inserted after the content of the element. 2:lang (language) p:lang (it) is determined to have each with the value of the lang attribute starting with "it"

element. On the back of the 2element1~element2p~ul selection

Each element of the element. 3 [attribute ^ = value] a [src ^ = "https"] determines each element whose src attribute value begins with "https". 3 [attribute$=value] a [src$= ".pdf"] Select all elements whose src attribute ends with ".pdf". 3 [attribute*=value] a [src*= "abc"] determines each element of the solicit "abc" substring in its src attribute. 3:first-of-typep:first-of-type is determined to belong to the first of its parent element

Each of the elements

element. The 3:last-of-typep:last-of-type resolution belongs to the last of its parent element

Every one of the elements

element. 3:only-of-typep:only-of-type is determined to belong to the only element of its parent

Each of the elements

element. 3:only-childp:only-child resolves each of the only child elements of its parent element

element. 3:nth-child (n) p:nth-child (2) selects each of the second child elements that belong to its parent element

element. 3:nth-last-child (n) p:nth-last-child (2) is the same as above, counting from the last child element. 3:nth-of-type (n) p:nth-of-type (2) selects the second one belonging to its parent element

Each of the elements

element. 3:nth-last-of-type (n) p:nth-last-of-type (2) is the same as above, but starts counting from the last child element. 3:last-childp:last-child decides to belong to each of the last child elements of its parent element

element. 3:root:root chooses the root element of the document. 3:emptyp:empty is determined to have each of the child elements

Elements (including text nodes). 3:target#news:target selects the # news element of the current activity. 3:enabledinput:enabled determines each enabled element. 3:disabledinput:disabled selects each disabled element 3:checkedinput:checked selects each selected element. 3:not (selector): not (p) decides not

Each element of the element. The element department that 3::selection::selection decides to be selected by the user. The above is all the contents of the article "what are the CSS3 selectors and how to use them?" Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more 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