CSS series: CSS3 new Selector

Source: Internet
Author: User

1. CSS1-defined selectors Selector
Selectortype Description
E Type Selector Select an element of the specified type
E#id ID Selector Select the element that matches E, and the ID of the matching element is "id" and the e-selector can be omitted.
E.class Class Selector Select the element that matches E, and the class attribute value of the matching element is "class", and the E-selector can be omitted.
E F Include selector Select the element that matches F, and the element is contained within the element that matches E.
E:link Link Pseudo class Selector Select the element that matches E, and the matching element is defined and the hyperlink is not accessed. Example: A:link
e:visited Link Pseudo class Selector Select the element that matches E, and the matching element is defined with a hyperlink and has been accessed. Example: a:visited
E:active User Action Pseudo-class selector Select the element that matches E, and the matching element is activated
E:hover User Action Pseudo-class selector Select the element that matches E, and the matching element is being passed by the mouse
E:focus User Action Pseudo-class selector Select the element that matches E, and the matching element gets the focus
E::first-line Pseudo element Selector Select match the first line of text within the E element
E::first-letter Pseudo element Selector Select to match the first character within the E element
2. CSS2-Defined selectors Selector
Selectortype Description
* A wildcard selector Select all elements in a document
E[foo] Property Selector Select the element that matches E, and the element defines the Foo attribute. The e-selector can be omitted to indicate that any type of element that defines the Foo attribute is selected.
E[foo= "Bar"] Property Selector Select the element that matches E, and the element Foo property value is "Bar"
E[foo~= "Bar"] Property Selector Select the element that matches E, and the element defines the Foo attribute, and the Foo property value is a space-delimited list with the value "bar" for one list, and the E-selector to omit.
E[foo!= "en"] Property Selector Select the element that matches E, and the element defines the Foo attribute, and the Foo property value is a list separated by a hyphen (-) with the value starting with "en".
E:first-child Structure pseudo-Class selector Select the element that matches E, and the element is the first child of the parent element
E::before Pseudo element Selector Insert content before the element that matches E
E::after Pseudo element Selector Insert content after the element that matches E
E > F Child contains selectors Select the element that matches F, and the element is the child element of the matched e element.
E + F Adjacent sibling selector Select the element that matches F, and the element is the adjacent position following the E element.
3. CSS3 new Property Selector Selector
Selectortype Description
E[foo^= "Bar"] Property Selector Select the element that matches E, and the element defines the Foo attribute, and the Foo attribute value starts with "bar". The e-selector can be omitted to indicate that an element of any type can be matched.
E[foo$= "Bar"] Property Selector Select the element that matches E, and the element defines the Foo attribute, and the Foo attribute value ends with "bar". The e-selector can be omitted to indicate that an element of any type can be matched.
E[foo*= "Bar"] Property Selector Select the element that matches E, and the element defines the Foo attribute, and the Foo property value contains "bar". The e-selector can be omitted to indicate that an element of any type can be matched.

CSS series: CSS3 new 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.