View on GitHub

notes

A collection of my TIL notes and commonplace book entries.

CSS Attribute Selectors

Check if an attribute exists on an element

[value]

Check if attribute has a specific value

[value='cool']

Check if attribute value contains the word “cool” somewhere in it

[value*='cool']

Check if attribute value contains “cool” as one of the items in a space-separated list

[value~='cool']

Check if the attribute value starts with the word “cool” in a dash-separated list

[value|="cool"]

Check if the attribute value starts with the word “cool”

[value^="cool"]

Check if the attribute value ends with the word “cool”

[value$="cool"]

Source: https://twitter.com/EmmaBostian/status/1222939913462697984/photo/1