One, type selector
Body
{
font-size:12px;
}
{
Color:blue;
}
A selector for the name of a label type already in the Web page, as indicated above: All text size within the body tag is 12px, and the text color in the paragraph is blue.
Second, group selector
H4,p,span
{
font-size:12px;
}
Indicates that all H4,p,span labels in the page are 12px in size, that is, the same style is specified for a group of objects, and each label is separated by commas.
Third, include selectors
Div p
{
Font-weight:bold;
}
Indicates that the text in the P tag inside the div tag is in bold, this is a containment relationship, and each label is separated by a space and can be contained in multiple levels.
Iv. ID and Class selector
The ID is a style definition for the unique element in the page, which is used only once in the page, that is, the ID is not duplicated
..
#myDiv
{
font-size:12px;
}
class defines a common or frequently used style, a style that needs to appear multiple times on a page, meaning that you can specify the same class for different labels, as follows: The fonts in the div and P tags are blue
..
. Red
{
Color:blue;
}
Five, combination selector
Use an ID or class, and also use tags to combine
H1 #cont
{
}
Represents a h1 label with ID cont
H1. cont
{
}
Represents all H1 tags that are class cont
VI. Pseudo-Class selectors
Common as a label
A:link
{
}
A:hover
{
}
a:visited
{
}
Seven, pass with the selector
*
{
Color:blue;
}
Indicates that all objects have a blue font.