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).
Asked
Active
Viewed 4.7k times
50

user2019515
- 4,495
- 1
- 29
- 42

mheavers
- 29,530
- 58
- 194
- 315
2 Answers
107
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.)

Explosion Pills
- 188,624
- 52
- 326
- 405
-
4And the descendant selector is the space, not "<". And an obligatory inane comment about how `*` is bad for performance, etc, as if performance matters to anyone. – BoltClock Mar 08 '13 at 20:44
-
@BoltClock not just bad for performance, but probably suggestive of something bad in the design – Explosion Pills Mar 08 '13 at 20:59