CSS [attr^=value] Selector

What is CSS [att^=value] Selector?

CSS [att^=value] selector matches all elements whose attribute value beginning with value string.


This is general syntax,

[attr^=value] {
  property: value;
  property: value;


Select every element whose attribute class value beginning with dem string to apply CSS style.

<!DOCTYPE html>
  <title>CSS [attr^=value] Selector</title>
  <style type="text/css">
    a[class^=dem] {
      background: yellow;
  <a class="demo" href="#">English International</a><br />
  <a class="de" href="#">English US</a><br />
  <a class="demos" href="#">Google</a><br />

Run it...   »

Browser Compatibility

  • Google Chrome 2+
  • Mozilla Firefox 3+
  • Internet Explorer 9+
  • Opera 9.5+
  • Safari 1.3+

Note: Here details of browser compatibility with version number may be this is bug and not supported. But recommended to always use latest Web browser.