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 HomepageMy 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 HomepageMy 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 HomepageMy name is Donald.
I live in Duckburg.
My best friend is Mickey.
Online operation