“大于"是怎么回事?或“>"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
是一个后代选择器,将遵循的样式应用于作为 P
子级的所有 SPAN
标签标记或作为 P
标记的子/后代的任何其他标记的递归子代.<代码>P >SPAN 仅适用于 SPAN
标记,它们是 P
标记的子标记.
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.
相关文章