CSS:选择一个元素及其所有后代元素 [英] CSS: select an element and all its descendant elements
本文介绍了CSS:选择一个元素及其所有后代元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
要选择元素及其所有后代元素:
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.
推荐答案
使用 XPath 您拥有 descendant-or-self
轴
但是CSS中没有这样的选择器.
But there is no such selector in CSS.
这篇关于CSS:选择一个元素及其所有后代元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文