I'm trying to apply CSS to any immediate child of a parent container element. How do I use CSS's descendant <
selector to select any immediate child regardless of type (div / span / etc).
The second selector above is a child combinator selector. This means it will only select list items that are direct children of an unordered list. In otherwords, it only looks one level down the markup structure, no deeper.
The * selector selects all elements. The * selector can also select all elements inside another element (See "More Examples").
When designing and developing web applications, sometimes we need to select all the child elements of an element except the last element. To select all the children of an element except the last child, use :not and :last-child pseudo classes.
I assume you mean the child selector. It's >
, not <
.
.parent > *
That will select any element. You can of course use any other selector as the child (an element, class, id, etc.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With