How it works

lxml converts the CSS selector you provide to XPath, and then performs that XPath expression against the underlying document. In essence, CSS selectors in lxml provide a shorthand to XPath, which makes finding nodes that fit certain patterns simpler than with XPath.