Advanced [attr] selectors

Not supported by Explorer 6-.

Selects elements with a certain attribute value. This page tests three attribute selectors:

  1. p[testAttr^=foo]: any element whose testAttr attribute has a value that starts with "foo".
  2. p[testAttr$=foo]: any element whose testAttr attribute has a value that ends with "foo".
  3. p[testAttr*=foo]: any element whose testAttr attribute has a value that contains "foo".

Testsheet:


p[testAttr^=foo] {font-style: italic;}
p[testAttr$=foo] {font-weight: bold;}
p[testAttr*=foo] {text-decoration: underline;}

This paragraph has testAttr="foobar". It should be italic and underlined.

This paragraph has testAttr="barfoo". It should be bold and underlined.