xpath 是 //div[contains(@class, 'a b') and not (contains(@style, 'c'))]
等效的 CSS 选择器是什么?轻松获得第一位 div[class*='a b']
,但如何否定和组合它们?
最佳答案
您使用 :not()
否定style
的选择器和另一个属性选择器属性。要组合它们,只需附上 :not()
到你已经拥有的结束。
等效的 CSS 选择器将是
div[class*='a b']:not([style*='c'])
关于xpath - Css 选择器等效于 '//div[contains(@class, ' a b') 而不是 (contains(@style, 'c' ))]',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16432184/