如何“大于”或“>”。字符在CSS中使用? [英] How is the "greater than" or ">" character used in CSS?
问题描述
我在CSS文件中看到过这个字符多次,但我不知道它的用法。
I have seen this character a number of times in CSS files but I have no idea how its used. Can anyone explain it to me and show how they are useful in making a page style easier?
推荐答案
这是一个CSS子选择器。 P> SPAN
表示将所有符合 P
标签的子标签的样式应用于所有SPAN标签。
It's a CSS child selector. P > SPAN
means applying the style that follows to all SPAN tags that are children of a P
tag.
请注意,儿童是指直系后裔,而不是任何后代。 P SPAN
是一个后代选择器,将后面的样式应用于所有 SPAN
是 P
标记的子项,或者是 P
标记的子项/后代的任何其他标记的递归子项。 P> SPAN
仅适用于 P
标签的子标签 SPAN
。
Note that "child" means "immediate descendant", not just any descendant. P SPAN
is a descendant selector, applying the style that follows to all SPAN
tags that are children of a P
tag or recursively children of any other tag that is a child/descendant of a P
tag. P > SPAN
only applies to SPAN
tags that are children of a P
tag.
这篇关于如何“大于”或“>”。字符在CSS中使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!