div * + * {
margin-top: 1em;
}
I have seen this selector a lot.
I know div * means to select all the children
+ means to select all the siblings after that element
But what does it means to use * + *?
div * + * {
margin-top: 1em;
}
I have seen this selector a lot.
I know div * means to select all the children
+ means to select all the siblings after that element
But what does it means to use * + *?
When you use the + character, you should focus on the end of your combinator statement, in this case the last * character in div * + *.
div * means all elements in the div. div * + means adjacent elements of all elements in the div. div * + * means all adjacent element of all elements in the div. To wrap this up, All element in the div tag that proceed other elements must receive a top margin of 1em. For more explanation on this The lobotomized owl selector