Search code examples
csscss-selectorsdescendant

Select an element and all its descendant elements


To select an element and all its descendant elements:

.media, .media * {color: #f00;}

Is there just one selector I can use instead of two selectors separated by a comma? I'm looking for a more efficient way to type this.


Solution

  • With XPath you have the descendant-or-self axis

    But there is no such selector in CSS.