CSS selector Daquan

Source: Internet
Author: User

The CSS selector is used to select the mode of the element you want to style.

The "CSS" column represents the property definition in the CSS version (CSS1,CSS2, or CSS3).

Selector
SelectorExample Example Description CSS
. class . intro Select all elements of class= "Intro" 1
#ID #firstname Select all elements of id= "FirstName" 1
* * Select all elements 2
Element P Select all <p> elements 1
Element,element Div,p Select all <div> elements and <p> elements 1
element element Div p Select all <p> elements within the <div> element 1
element>element Div>p Select all the parent is the <p> element of the <div> element 2
element+element Div+p Select all <p> elements immediately following the <div> element 2
[attribute] [Target] Select all elements with the target property 2
[attribute=value] [Target=-blank] Select all elements that use target= "-blank" 2
[attribute~=value] [Title~=flower] Select the Title property contains all elements of the word "flower" 2
[attribute|=language] [Lang|=en] Select the starting value of a lang attribute = all elements of "EN" 2
: Link A:link Select All not visited links 1
: Visited a:visited Select all the links you have visited 1
: Active A:active Select Active link 1
: hover A:hover Select mouse over link 1
: Focus Input:focus Select the INPUT element with focus 2
: First-letter P:first-letter Select the first letter of each <P> element 1
: First-line P:first-line Select the first line of each <P> element 1
: First-child P:first-child Specifies a style only if the <p> element is the first child of its parent. 2
: Before P:before Insert content before each <p> element 2
: After P:after Insert content after each <p> element 2
: lang (language) P:lang (IT) Select the starting value of a lang property = all <p> elements of "it" 2
element1~element2 P~ul Select each UL element after the P element 3
[attribute^=value] a[src^= "https"] Select the element with the value of each SRC attribute beginning with "https" 3
[attribute$=value] A[src$= ". pdf"] Select the element that ends with a ". pdf" value for each SRC attribute 3
[attribute*=value] A[src*= "44lan"] Select the value of each SRC attribute that contains the element "44lan" of the substring 3
: First-of-type P:first-of-type Select each P element to be the first P-element of its parent 3
: Last-of-type P:last-of-type Select each P element is the last P element of its parent 3
: Only-of-type P:only-of-type Select each P element to be the only P element of its parent 3
: Only-child P:only-child Select each P-element to be the only child of its parent 3
: Nth-child (n) P:nth-child (2) Select each P-element is the second child of its parent 3
: Nth-last-child (n) P:nth-last-child (2) Select the second child element of each P-element that is its parent, counting from the last subkey 3
: Nth-of-type (n) P:nth-of-type (2) Select each P element is the second P element of its parent 3
: Nth-last-of-type (n) P:nth-last-of-type (2) Select the second P element for each P element that is its parent, counting from the last subkey 3
: Last-child P:last-child Select each P-element to be the last child of its parent. 3
: Root : Root Select the root element of the document 3
: Empty P:empty Select each P element without any children (including text nodes) 3
: Target #news: Target Select the currently active #news element (the URL of the click that contains the anchor name) 3
: Enabled Input:enabled Select each INPUT element that is enabled 3
:d isabled Input:disabled Select each of the disabled input elements 3
: Checked Input:checked Select each selected INPUT element 3
: Not (selector) : Not (P) Select each element that is not a P element 3
:: Selection :: Selection Matches the part of the element that is selected by the user or is in the highlighted state 3
: Out-of-range : Out-of-range INPUT element that matches the value outside the specified interval 3
: In-range : In-range INPUT element that matches the value within the specified interval 3
: Read-write : Read-write Used to match readable and writable elements 3
: read-only : read-only The element used to match the setting "ReadOnly" (read-only) attribute 3
: Optional : Optional Used to match optional input elements 3
: Required : Required Used to match elements that have the "required" property set 3
: Valid : Valid Used to match elements with input values that are legal 3
: invalid : invalid Used to match an element with an invalid input value 3

CSS selector Daquan

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.