These selectors are used to retrieve content that matches certain conditions, such as whether they contain certain content, whether they are visible/hidden, or whether they are in a certain position within their parent.
:contains('text')
: select elements that contain specific text:parent
: select elements have at least one child node (element or text):has(selector)
: select elements that contain at least one element that matches the selector:first-child
: select elements that are the first child of their parents:last-of-type
: select elements that are the last of their type among siblings:nth-child()
: select elements that are the nth child of their parent
This is paragraph 1
This is paragraph 2
This is paragraph 3
This is paragraph 4
This is paragraph 5