CSS Attribute selector

CSS Attribute selector

Sometime we need to target some elements in different way in css. Here is list of CSS3 selector you can use to select any elements with attributes.

  • [attribute] – select elements with a specified attribute.
  • [attribute=“value”] – select elements with a specified attribute and value.
  • [attribute~=“value”] – select elements with an attribute value containing a specified word.
  • [attribute|=“value”] – select elements with the specified attribute starting with the specified value.
  • [attribute^=“value”] – select elements whose attribute value begins with a specified value.
  • [attribute$=“value”] – select elements whose attribute value ends with a specified value.
  • [attribute*=“value”] – select elements whose attribute value contains a specified value.

Leave a Reply

Close Menu