选择所有直接后代dom元素,无论类型如何 [英] Select all direct descendant dom elements regardless of type
本文介绍了选择所有直接后代dom元素,无论类型如何的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试将CSS应用于父容器元素的任何直接子代.如何使用CSS的后代<
选择器选择任何直接子级,而不管类型(div/span/etc)如何.
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).
推荐答案
我假设您的意思是子选择器.是>
,而不是<
.
I assume you mean the child selector. It's >
, not <
.
.parent > *
这将选择任何元素.您当然可以使用其他选择器作为子代(元素,类,id等)
That will select any element. You can of course use any other selector as the child (an element, class, id, etc.)
这篇关于选择所有直接后代dom元素,无论类型如何的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文