Skip to content

Latest commit

 

History

History
17 lines (14 loc) · 2.7 KB

File metadata and controls

17 lines (14 loc) · 2.7 KB
title slug
CSS 选择器与 XPath 的对比
Web/XPath/Comparison_with_CSS_selectors

{{XsltSidebar}}

本文旨在记录 CSS 选择器和 XPath 之间的区别,以便 Web 开发人员能够更好地为正确的工作选择合适的工具。

XPath 特性 CSS 等价形式
ancestorparentpreceding-sibling {{CSSxRef(":has",":has()")}} 选择器 {{experimental_inline}}
attribute 属性选择器
child 子代组合器
descendant 后代组合器
following-sibling 后续兄弟组合器接续兄弟组合器
self {{CSSxRef(":scope")}} 或 {{CSSxRef(":host")}} 选择器