[Solved] how to only target a css class if it is the first element within the body tag? [duplicate]

[ad_1]

You can target an element as direct child of the body only if it’s both the first-child and with a specific class name

body > .yourclass:first-child {
   ...
}

:first-child matches a specific element, regardless of its class name but in this case the class must be also chained. All other elements with that class name won’t be styled.


Codepen demo

0

[ad_2]

solved how to only target a css class if it is the first element within the body tag? [duplicate]