Basic CSS Selector

Source: Internet
Author: User

1. Mark Selector

Declare which tags use the CSS style. Therefore, the names of each HTML tag can be used as the names of the corresponding tag selector. Example:

Code:
    1. <Style>
    2. H1{
    3. Color:Red;
    4. Font-size:25px;
    5. }
    6. </Style>

2. Category Selector

The name of the class selector can be customized by the user. Example:

Code:
    1. "red" .......

In the HTML Tag, you can also apply multiple class selectors to a tag at the same time to apply the style of two classes to one tag at the same time.

Code:
    1. <H4Class ="Blue big"> Two classes, at the same timeBlueAnd big 4>

3. ID Selector

The use of ID and class is basically the same. The difference is that the ID selector can only be used once on the HTML page, so it is more targeted.

Code:
    1. "blod" ID selector

It is incorrect to use the ID selector for multiple tags because the ID defined by each tag can be called not only by CSS, but also by other scripting languages such as JavaScript. If the getelementbyid () function fails.

Id selector does not support simultaneous use of multiple styles like class selector. Similar to id = "bold Green" is a completely incorrect syntax.

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.