Applying styles to html
will work like with any other element and its children: styles trickle down from the top unless the child has its own definition.
With * you set the style for each element individually, so it's applied to each first level element, second level element and so forth.
An example of a practical difference is when using the >
operator, which applies styles to direct children of the element:
* > p {
font-size: 12px;
}
Will set the font size to every p
that's directly a child of any element in the DOM, regardless of how deep it is.
html > p {
font-size: 12px;
}
Will set the font size of every p
that's directly a child of the html element, which would not happen, since body
and head
are usually the only children of html