Skip to content

CSS Selectors

Attribute contains value in list (hyphen)

About

The [attr|=value] selector matches all elements with the specified attribute whose value contains a list of hyphen-separated values and the first value is exactly value.

Note: This is a contrived example. In practice, you should use the language selector.

(Non-)Matching attribute

The example matches all elements with the lang attribute starting the word en.

  • Change the selector to match German (Switzerland) and German (Germany).
  • Change the selector to match only German (Switzerland)