1. Type selector
body
{
font-size:12px;
}
{
color:blue;
}
Refers to the web page The existing tag type in the tag is used as the selector of the name, as shown above: the size of all text within the body tag is 12px; the color of the text within the paragraph is blue.
2. Group selector
h4,p,span
{
font-size:12px;
}
Indicates that all the text in the h4, p, span tags on the page are 12px size, that is, specify the same style for a group of objects, separated by commas between each tag.
3. Contain the selector
div p
{
font-weight:bold;
}
It means that the text in the p tag inside the div tag is bold. This is An inclusion relationship, each tag is separated by a space, and can be multi-level inclusion.
IV. id and class selectors
id is a style definition for the only element in the page. This style is only used once in the page, that is, the id is not repeated
..