CSS Property Selector

Source: Internet
Author: User

p[name]{background:red;} Use only property names
p[name=ghr]{background:red;} Specifies the property name and specifies the property value of the property
p[name~=old]{background:red;} This property value is a list of words, separated by a space, where the word list contains a value word
P[name^=g]{background:pink;} The property value starts with G
P[name$=m]{background: #CC0;} The value of the property is the end of M
P[name*=d]{background: #C3C;} The genus value contains value
P[name|=b]{background: #C3C;} The value of the property is either value or the values beginning with "value-" (for example, ZH-CN)
IE7 and above support

<body><p name= "BGHR" > Small black </p><p name= "b-ghr old" > Small white </p><p name= "GHR" >ghr</p ><p name= "DP" > Shop </p><p name= "Gzm" >gzm</p><p name= "XM" > Amy </p></body>

  


Type is typed, value restriction type
no type is structural type, restricted position and type(self-summed, with questions Welcome to point out)
P:nth-child (2) Find the second sub-element under the parent of P tag and be P label
P:nth-child (odd) {background:red}/* matches odd lines */
P:nth-child (even) {background:red}/* spouse number of lines */
P:nth-child (2n) {background:red}
E:nth-last-child (n) represents the nth Word node in the e parent element, and the type E is calculated from the backward forward structure type
P:nth-of-type (2) Find the second P-element type under P-parent
E:nth-of-type (n) denotes the nth e-type byte point in the parent element of E
E:nth-last-of-type (n) represents a child node of the nth type E in the e parent element, calculated from the back forward
E:empty indicates that there are no child nodes in the E element. Note: Child nodes contain text nodes
P:first-child represents the first child node in the p parent element and is P
E:last-child represents the last child node in the E element
E:first-of-type indicates that the first node type in the e parent element is E
E:last-of-type indicates that the last node type in the e parent element is E
E:only-child indicates that there is only one child node in the E element. Note: Child nodes do not contain text nodes
E:only-of-type indicates that there is only one child node in the parent element of E, and that the unique child node must be of type E. Note: Child nodes do not contain text nodes
Selector pseudo-Class:
E:target represents the element type of the current URL fragment, which must be an E
E:disabled represents a non-clickable form control
E:enabled represents a clickable form control
E:checked indicates that a checkbox or radio is selected
E:first-line represents the first row in the E element
E:first-letter represents the first character in the E element
E::selection represents the E element when the user selects text
E::before generate content before e element

CSS Property Selector

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.