CSS [attr*=value] Selector

What is CSS [att*=value] Selector?

CSS [att*=value] selector matches all elements whose attribute value contain at least one substring value string.


This is general syntax,

 [attr*=value] {   property: value;   property: value;   ... }


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

 <!DOCTYPE html> <html> <head>   <title>CSS [attr$=value] Selector</title>   <style type="text/css">     a[class$=dem] {       background: yellow;     }   </style> </head> <body>   <a class="subdemo" href="#">English International</a><br />   <a class="subdem" href="#">English US</a><br />   <a class="subdemos" href="#">Google</a><br /> </body> </html>

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.