Show pageOld revisionsBacklinksFold/unfold allBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. From: https://scrapfly.io/blog/css-selector-cheatsheet ^ Selector ^Explanation ^ | |**Navigation** | | > |selects direct child | | ''%% %%'' (space) |selects any descendant | | ~ |selects following sibling | | + |selects direct following sibling | | , |separator for joined selectors | | |**Attribute Matching** | | . |selects by class | | # |selects by id | | [] |attribute selector | | [attr] |select elements that have attribute present (even if it's empty) | | [attr=value] |match exact attribute value | | [attr=value i] |''i'' suffix turns any attribute match case insensitive | | [attr*=value] |match containing attribute value | | [attr%%|%%=value] |match exact ignoring "-suffixes" value | | [attr%%^%%=value] |match attributes that start with value | | [attr$=value] |match attributes that end with value | | [attr~=value] |match attributes that contain a word | | |**Element Matching** | | :not() |reverses selection | | :has() |select if element has a matching descendant | | :is() |apply multiple selectors | | :first-child |select if it's the first element in the group | | :last-child |select if it's the last element in the group | | :nth-child() |select if it's the Nth element, supports ''%%even%%'', ''%%odd%%'' | | :nth-last-child() |like ''nth-child'' but reversed | | :first-of-type |select if it's the first element of that type in the group. | | :last-of-type |select if it's the last element of that type in the group. | | :nth-of-type() |select if it's the Nth element of that type in the group. | | :only-of-type() |select if it's the only element of that type in the group. | | |**Non-standard Functions** | | ::attr(name) |select attribute value. Available in [[https://pypi.org/project/Scrapy/|scrapy]], [[https://pypi.org/project/parsel/|parsel]], [[https://scrapfly.io/docs/sdk/python|Scrapfly SDK]] | | :text |select text value. Available in [[https://pypi.org/project/Scrapy/|scrapy]], [[https://pypi.org/project/parsel/|parsel]], [[https://scrapfly.io/docs/sdk/python|Scrapfly SDK]] | css_cheatsheet.txt Last modified: 2025/03/21 03:08by root1