The selection character of CSS

Source: Internet
Author: User

One. Selector mode

Pattern/meaning/content description

*

matches any element. (Universal selector)

E

Matches any element e (for example, an element of type E). (type selector)

E F

Matches any descendant element F of element E. (descendant selector)

E > F

Matches any child element F of element E. (sub selector)

E:first-child

When Element e is the first child element in its parent element, the match element E. (: First-child pseudo Class)

E:link e:visited

Match element E If E is a destination that has not been accessed (: link) or a hyperlink that has already visited (: visited). (Link pseudo Class)

E:active E:hover E:focus

Match E in the determined user action. (Dynamic pseudo Class)

E:lang (c)

If an element of type E uses the (human) language C (the document language determines how the language is determined), the element is matched. (: lang () pseudo class)

E + F

If an element E is directly before the element F, then the element f is matched. (near selector)

E[foo]

Matches any element E that has an "foo" attribute set (regardless of its value). (Property selector)

e[foo= "Warning"]

Matches any element E whose "foo" attribute value is strictly equal to "warning". (Property selector)

e[foo~= "Warning"]

Matches a list of values whose "Foo" property value is a space-delimited, and one of them is strictly equal to any element E of "warning". (Property selector)

E[lang|= "en"]

Any element E that matches its "Lang" property with a list of values beginning with "en" (from the left). (Property selector)

Div.warning

HTML only. Usage with div[class~= "warning"]. (class selector)

E#myid

Any element E that matches the ID equal to "myID". (ID selector)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.