attribute selectors

selector

notes

[attribute="value"]

select elements with a specified attribute and value

[attribute^="value"]

attribute begins with a specified value (doesn't have to be a whole word).

[attribute$="value"]

attribute ends with a specified value.

[attribute*="value"]

attribute contains a specified value.

[attribute~="value"]

attribute value containing a specified word.

⭐️ 注意:要「整個單字」一樣才算❗️

吻合:"value is", "my value"

不合:"values", "my-value"

[attribute|="value"]

attribute starting with the specified value.

吻合:"value", "value-key" (followed by hyphen)

不合:"values"

Last updated