CSS Selector [attribute*=value]








The [attribute*=value] selector selects every element whose attribute contains the value.

Summary

CSS Version
3

CSS Syntax

[attribute*=value] { 
   style properties 
}

Browser compatibility

[attribute*=value] Yes 7.0 Yes Yes Yes




Example

An example showing how to use [attribute*=value] CSS selector.

<!DOCTYPE html>
<html>
<head>
<style> 
div[class*="myStyle"]{
   background:red;
}<!--   ww w  .  ja v  a  2 s  .  c o m-->
</style>
</head>
<body>
   <div class="myStyle">div element.</div>
   <p class="myStyle">paragraph.</div>
</body>
</html>

Click to view the demo