Css Tag selector, id selector, and class selector instance

Source: Internet
Author: User
This article provides examples to illustrate how to use the tag selector, id selector, and class selector in css. For more information about coders, see this article. 1: Tag Selector

The tag selector is effective for all tags with certain labels. Take p as an example, that is, all the styles with p tags will look like this.

Instance: select all

Element:

Welcome to My Homepage

My name is Donald.

I live in Duckburg.

My best friend is Mickey.

Online operation

2: id Selector

Note that the id selector is unique, because only id = "yy" has this style, and the element Id in a page must be unique... You know that the id selector starts with #. Its usage is: id = ""

Instance: Add a specified style for the id = "firstname" element:

Welcome to My Homepage

My name is Donald.

I live in Duckburg.

My best friend is Mickey.

Online operation

3: class selector.

The class selector starts with a.. You only need to show the class = "" of the element as this style. The usage is: class = ""

Instance:

Welcome to My Homepage

My name is Donald.

I live in Duckburg.

My best friend is Mickey.

Online operation

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.