CSS Selector list

Source: Internet
Author: User

H1 Type Selector Select a type of element
. className Class Selector Select an element with the value of the Class property, which can appear in a page with multiple
#idName ID Selector Select an element with the value of the id attribute, which is unique in the page and can only occur once

Article H2 Descendant Selector Select descendant elements within the specified ancestor element
Article > H2 Child element Selector Select a direct child element within the specified parent element

H2 ~ P Adjacent sibling selector Select the sibling element after the first element, both with the same parent element
H2 + P Child element Selector Select the element immediately after the first element, both with the same parent element

A[target] Target Property Selector Select an element that has a property
A[href= "http://google.com/"] Attribute Equality Selector Select an element with a property value that matches a specific value
a[href*= "Login"] property contains selectors Select an element with a property value that contains a specific value
a[href^= "https://"] Property Start Selector Select an element with a property value beginning with a specific value
A[href$= ". pdf"] End-of-property selector Select an element with a property value ending with a specific value
a[rel~= "Tag"] Attribute interval Selector Select an attribute value that is separated by whitespace into multiple words, and one of the words matches the element of the given value
A[lang|= "en"] Property Connector Selector Select an attribute value that is split into multiple words by a connector, and one of the words matches the element of the given value

A:link Link pseudo-Class Select a link that a user has not visited
a:visited Link pseudo-Class Select a link that a user has visited
A:hover Behavioral pseudo-Class Select a user to hover the mouse pointer over the element
A:active Behavioral pseudo-Class Select an element in the user's use
A:focus Behavioral pseudo-Class Select an element that has user focus
Input:enabled State pseudo-Class Select an element that is under the editable state (default)
Input:disabled State pseudo-Class Select an element in a non-editable state by setting the Disabled property
Input:checked State pseudo-Class Select a selected radio or check button
Input:indeterminate State pseudo-Class Select a radio or check button in an indeterminate state (may be selected or unchecked)
Li:first-child Structural pseudo-Class Select the first child element under a parent element
Li:last-child Structural pseudo-Class Select the last child element under the parent element
Div:only-child Structural pseudo-Class If an element is the only child element in its parent element, it will be matched
P:first-of-type Structural pseudo-Class Select the 1th child element of the same type in the parent element
P:last-of-type Structural pseudo-Class Select the last child element of the same type in the parent element
Img:only-of-type Structural pseudo-Class If the element is a unique element of the same type in the parent element, it will be matched
Li:nth-child (2n+3) Structural pseudo-Class When the sequence of a child element of a parent element matches the given number, it is selected, and all elements are calculated as a starting point at the beginning of the document tree
Li:nth-last-child (3n+2) Structural pseudo-Class When the sequence of a child element of a parent element matches the given number, it is selected, and all elements are calculated as a starting point at the beginning of the document tree
P:nth-of-type (3n) Structural pseudo-Class When the sequence of a child element of a parent element matches the given number, it is selected, starting at the beginning of the document tree, and counting only the elements of a given type in the document tree
P:nth-last-of-type (2n+1) Structural pseudo-Class When the sequence of a child element of a parent element matches the given number, it is selected, starting at the beginning of the document tree, and counting only the elements of a given type in the document tree
Section:target Target Pseudo-Class Select the element to which the value of the URI fragment identifier points
Div:empty Empty Pseudo class Select an element without any child elements or text
Div:not (. Awesome) Negation pseudo-Class Select an element that does not match a status identifier



.alpha:first-letter text pseudo-element
.bravo:first-line text pseudo-elements Select the first line of text within an element
div:before What's generated
a:after content generated Create pseudo-elements at the end of selected elements
: Selection

CSS Selector list

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.