offline version v3


294 of 298 menu

Selector by attribute value start

The selector by attribute value start applies a style to an element whose tag attribute value starts with the specified text.

Example

Let's select the <a> tag, which has the href attribute value that starts with https and recolor it red:

<a href="file.html">link1</a> <a href="https://code.mu">link2</a> a[href^="https://"] { color: red; }

:

See also

  • an attribute selector
    that searches for an element by attribute name
  • an attribute selector
    that searches for an element by attribute value
  • an attribute selector
    that searches for an element based on the end of an attribute value
  • an attribute selector
    that searches for an element by text in an attribute value
  • an attribute selector
    that searches for an element based on one of attribute values
  • an attribute selector
    that searches for an element by a hyphen in an attribute value
  • the child selector
    that allows you to select elements by direct nesting
  • the descendant selector,
    that allows you to select an element by its parent
  • the adjacent sibling selector
    that allows you to select an element by its sibling
  • the general sibling selector
    that allows you to select elements after a given
  • the universal selector
    that allows you to select all elements
enru