CSS [attribute*="value"]
selector selects all the elements whose attribute contain the specified value. The specified value needs not be a whole word and can be anywhere inside the attribute like: in the beginning, middle, or at the end.
The [attribute*=”value”] selector in the example below selects all the <p>
elements that contain the value ‘nal’ in their class
attribute and sets their background color to yellow.
Example:
p[class*="nal"]{ background: yellow; }
Select all the <img>
elements whose a
lt attribute contains the word ’round’ and set their border radius to 50%.
Example:
img[alt*="round"]{ border-radius: 50%; }
CSS Syntax
The [attribute*=”value”] selector has the following syntax:
[attribute*="value"]{ CSS styles }
Related Pages
CSS Tutorials: CSS Attribute Selectors