What syntax does the selector have in CSS3

Source: Internet
Author: User
Today to introduce the common selector syntax in CSS3, the syntax is generally divided into three kinds, basic selector syntax, hierarchy selector syntax and dynamic pseudo-class selector syntax. The following will give you a detailed explanation.

1, basic selector syntax

(1) * Wildcard Selector Select a document so HTML elements

(2) E element Selector Selects HTML elements of the specified type

#id The ID selector Select any type element that specifies the id attribute value is "id"

The. Class selector selects any number of elements of any type that specify a class attribute value of "class"

Selector1,selectorn Group Selector Merges the set of elements matching each selector

2, Hierarchy selector syntax

(1) E F descendant selector (contains selector) selects the matched F element, and the matched F element is contained within the matched e element

(2) The E>F sub-selector selects the matched F element, and the matched F element matches the child element of the E element

(3) E+f the adjacent sibling selector selects the matched F element, and the matched F element is positioned immediately after the matched e element

(4) The E~F Universal selector selects the matched F element, and all matching f elements after the matched e element

3, dynamic Pseudo-class selector syntax

(1) The E:link link pseudo-class selector selects the matched e element, and the matching element is defined and the hyperlink has not been accessed. Often used on link strokes.

(2) The e:visited link pseudo-class selector selects the matching e element, and the matching element is defined with a hyperlink and has been accessed. Often used on link strokes.

(3) The e:active user behavior selector selects the matching e element, and the matching element is activated. Often used on link strokes and buttons

(4) The E:hover user behavior selector selects the matched e element, and the user mouse rests on the element E. IE6 and the following browsers only support A:hover

(5) E:focus the user behavior selector selects the matched e element, and the matching element gets the focus


I believe you have read the above introduction you have mastered the method, more exciting please pay attention to the PHP Chinese network other related articles!

Related reading:

Making method of making fireworks particle special effects with H5

Make Div width Adaptive teaching

Development experience of using H tags in web pages

Related Article

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.