問題描述
我在 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.
這篇關于“大于"是怎么回事?或“>"CSS中使用的字符?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!