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).
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
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.)