Thursday, 27 December 2018

css selectors - Select all child elements recursively in CSS

How can you select all child elements recursively?


div.dropdown, div.dropdown > * {
color: red;
}

This class only throws a class on the defined className and all immediate children. How can you, in a simple way, pick all childNodes like this:


div.dropdown,
div.dropdown > *,
div.dropdown > * > *,
div.dropdown > * > * > *,
div.dropdown > * > * > * > * {
color: red;
}

No comments:

Post a Comment