CSS selector and css3 Selector

Source: Internet
Author: User

CSS selector and css3 Selector

1. the selector has the following types:

1. ID selector # aaaa {}

2. class selector. aaaa {}

3. Attribute Selector

Simple: h1 [attribute name] {}

Specific: h1 [attribute name = ""] {}

Part 1: h1 [attribute name ~ = ""] {}

Start with: h1 [attribute name ^ = ""] {}

End: h1 [attribute name $ = ""] {}

Including: h1 [attribute name * = ""] {}

Specific: h1 [attribute name | = ""] {} (starting with the attribute value)

4. Descendant Selector

Basic: body h1 {}

Exact: h1> strong {}

Adjacent: h1 + p {} (the two elements must be adjacent and must have a common parent element)

5. Pseudo-class selector

: Pseudo class {}

Static

: Like (Hyperlink pointing to an unaccessed address)

: Visited (accessed address)

: First-child (select the first child element)

: Lang (language selection)

Dynamic
: Focus (elements with input focus currently)

: Hover)

: Active (User-activated element)

6. pseudo element Selector

Handwritten letter style: element: first-letter {} (it can only be applied to block-level elements such as tags or paragraphs, and cannot be used for intra-row elements such as hyperlinks)

First line style: element: firs-line {} (it can only be applied to block-level elements such as tags or paragraphs, and cannot be used for intra-row elements such as hyperlinks)

Before setting: element: before {content: "content"; style}

After setting: element: after {content: "content"; style}

 

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.