Some records of the CSS selector-jerrylsxu

Source: Internet
Author: User
Some records of the CSS selector-jerrylsxu
Selector Example Example description CSS
.Class . Intro Select all the elements of class = "intro. 1
#Id # Firstname Select all the elements of id = "firstname. 1
* * Select all elements. 2
Element P Select All

Element.

1
Element,Element P, p Select All

Element and all

Element.

1
Element Element P Select

All

Element.

1
Element>Element P> p Select the parent element

All elements

Element.

2
Element+Element P + p Select

All

Element.

2
[Attribute] [Target] Select all elements with the target attribute. 2
[Attribute=Value] [Target = _ blank] Select all the elements of target = "_ blank. 2
[Attribute~ =Value] [Title ~ = Flower] Select all elements whose title attribute contains the word "flower. 2
[Attribute| =Value] [Lang | = en] Select all elements whose lang attribute value starts with "en. 2
: Link A: link Select All unaccessed links. 1
: Visited A: visited Select All accessed links. 1
: Active A: active Select the activity link. 1
: Hover A: hover Select the link on which the mouse pointer is located. 1
: Focus Input: focus Select the input element that gets the focus. 2
: First-letter P: first-letter Select each

The first letter of an element.

1
: First-line P: first-line Select each

The first line of the element.

1
: First-child P: first-child Select each of the first child elements of the parent Element

Element.

2
: Before P: before

In each

Insert content before the content of the element. Content property value:

String,Url, Counter (Name) Counter (Name, list-style-type) Counters (Name, string)

Counters (Name, string, list-style-type), Attr (X), open-quote, close-quote,

No-open-quote, no-close-quote

2
: After P: after In each

Insert content after the element content.

2
: Lang (Language) P: lang (it) Select each lang attribute value starting with "it"

Element.

2
Element1~Element2 P ~ Ul Select

Each element

    Element.
3
[Attribute^ =Value] A [src ^ = "https"] Select each element whose src attribute value starts with "https. 3
[Attribute$ =Value] A [src $ = ". pdf"] Select all elements whose src attribute ends with ". pdf. 3
[Attribute* =Value] A [src * = "abc"] Select each element in the src attribute that contains the "abc" substring. 3
: First-of-type P: first-of-type Select the first element of the parent element.

Each element

Element.

3
: Last-of-type P: last-of-type Select the end of the parent Element

Each element

Element.

3
: Only-of-type P: only-of-type Select

Each element

Element.

3
: Only-child P: only-child Select each of the unique child elements of the parent Element

Element.

3
: Nth-child (N) P: nth-child (2) Select each of the second child elements of the parent Element

Element.

3
: Nth-last-child (N) P: nth-last-child (2) Same as above, counting starts from the last child element. 3
: Nth-of-type (N) P: nth-of-type (2) Select the second parent Element

Each element

Element.

3
: Nth-last-of-type (N) P: nth-last-of-type (2) Same as above, but starts counting from the last child element. 3
: Last-child P: last-child Select each of the last child elements of the parent Element

Element.

3
: Root : Root Select the root element of the document. 3
: Empty P: empty Select each element without child elements

Elements (including text nodes ).

3
: Target # News: target Select the # news element of the current activity. 3
: Enabled Input: enabled Select each EnabledElement. 3
: Disabled Input: disabled Select each disabledElement 3
: Checked Input: checked Select each selectedElement. 3
: Not (Selector) : Not (p) Select non-

Each element of an element.

3
: Selection : Selection Select the selected element. Only two attributes can be set: background and color. 3

On the css3.info website, you can test the compatibility of the current browser with the CSS selector. The test does not include hover,: active,: focus,: selection,: visited, and: link.

IE8 IE7 IE6

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.