gpt4 book ai didi

css - (p span) 和 (p > span) 有什么区别?

转载 作者:行者123 更新时间:2023-11-28 15:51:41 25 4
gpt4 key购买 nike

我很困惑,我想知道由于 p > spanp span 中的每一个的错误使用,代码会受到怎样的损害。我指的是与 span 相关的选择器 NOT p

最佳答案

p span 将定位恰好在 p 元素内的任何跨度,无论嵌套如何。

p > span 将仅针对作为 p 元素的直接后代的跨度。

例如。

<p><div><span>this will match the first but not the second</span></div></p>

<p><span>this will match both</span></p>

关于css - (p span) 和 (p > span) 有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19352328/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com