CSS Selector (CSS Ultimate guide reading review)

Source: Internet
Author: User
CSS selector syntax

CSS stylesheets are composed of selectors and life blocks. The declaration block has a property name, a property value, a colon separated by the middle, and a semicolon ending.

Selector Group actions

You can combine several selectors into a piece to quickly select the elements of the operation. For example, h1,h2,h3,h4,h5,h6{color:red;}

* Wildcard selector, select all the elements.

Tag Selector class Selector

Consists of a dot plus a name. The HTML tag is required to add the class attribute.

The class can be used in conjunction with the tag selector: P.class1.

Two classes can be used in the. Class1.class2 mode, select Class= "Class1 class2".

ID Selector

#加名字.

There is a limit, an element can have only one ID.

The ID selector is larger than the weight of the class.

Property Selector

The Class,id selector is a special case of the property selector.

[Attribute]

[attribute= "Value"]

[attribute~= "Value"]

[attribute^= "Value"]

[attribute$= "Value"]

[attribute*= "Value"]

[attribute|= "Value"]

Descendant Selector

H span

H>span

H+p

Pseudo class

Some state of the element

The status of a link link,visitied

Dynamic pseudo-class for all elements: Active,focus,hover

Static Pseudo-Class: First-children

Pseudo element

Creates a virtual element

: First-letter

: First-line

: After,:before

CSS Selector (CSS Ultimate guide reading review)

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.