CSS combination selector and css combination
1. Select all descendant elements with spaces
Div p
{
Background-color: yellow;
}
Select all descendant p elements of the div element, which can be child elements and child elements...
2. Greater than Id> select all direct child layer elements
Div> p
{
Background-color: yellow;
}
Select all direct child elements of the div element, with only one child element
3. Wave Number ~ Select All sibling elements at the same Layer
Div ~ P
{
Background-color: yellow;
}
Select All sibling elements in the same layer of the div Element
4. plus sign + select the first sibling element of the same Layer
Div + p
{
Background-color: yellow;
}
Select the first sibling element of the same layer of the div element.
5. p: first-child select the first p element
P: first-child
{
Color: blue;
}
Select the first p element.