gpt4 book ai didi

html - 元素内元素位置的 CSS 选择器

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

有没有针对这种情况的 CSS 选择器语法?

<a href="#">Link text <span>123</span></a>

对比

<a href="#"><span>123</span> Link text</a>

我需要查明是否 <span>123</span>Link text 之前或之后.

现在我用额外的 span 类解决了它 before|after ,但我想知道,是否可以通过选择器实现。有什么想法吗?

最佳答案

不,你无法区分这些情况。根据Structural pseudo-classes ,

Standalone text and other non-element nodes are not counted when calculating the position of an element in the list of children of its parent.

关于html - 元素内元素位置的 CSS 选择器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37367959/

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