<Divclass= "Gradefather">Hello1<Divclass= "Father">Hello2<Pclass= "Son">Hello4</P> </Div> <P>Hello3</P> <P>Hello5</P></Div>
I. A, B: arbitrary selector A or
div,p { #所有div或者p标签font-size:10px;color:blue;}
Second, a B: descendant selector, all B under a tag
Div p {#div下所有p标签font-size:20px;color:green;}
Third, A>b: Sub-selector, only the son level will be selected.
gradefather>p {#gradefather的子标签, only Hello3 hello5 will function font-size:20px;color:red;}. father>p {#father的子标签, only Hello4 will function font-size:20px;color:red;}
Four, A+b: adjacent to the selector, only adjacent to the same level (brother sibling) The first one will be selected.
#father的第一个邻居, only Hello3 will function Font-size:20px;color:green;}
Attention:
1. Block-level elements can contain inline elements or some block-level elements, but inline elements cannot contain block-level elements, which can contain only other inline elements. Block-level labels take one row by default, and inline labels occupy a space of content size.
2. There are several special block-level elements that can contain only inline elements and cannot contain block-level elements. such as H1,h2,h3,h4,h5,h6,p,dt
3, Li can contain div
4. Block-level elements are tied to block-level elements, inline elements and inline elements.
CSS QuickStart-combining selectors