CSS | [attribute*=value] Selector
The [attribute*=”str”] selector is used to select those elements whose attribute value contains the specified sub string str. This sub string could be at the start, end or in the middle of the class.
Syntax:
element [attribute*="str"] {
// CSS Property
}
Example:
<!DOCTYPE html> <html> <head> <title> CSS [attribute*="str"] Selector </title> <!-- CSS property --> <style> p[class*="for"] { background: green; color: white; } </style> </head> <body> <h1>GeeksForGeeks</h1> <h2>[attribute*=value] Selector</h2> <p class="GeeksforGeeks">GeeksforGeeks</div> <p class="forGeeks">A computer science portal</div> <p class="Geeks">Sudo GATE</p> <p class="for">Sudo placement</p> </body> </html> |
chevron_right
filter_none
Output:

Supported Browsers: The browser supported by [attribute*=value] Selector are listed below:
- Google Chrome 4.0
- Internet Explorer 7.0
- Firefox 3.5
- Apple Safari 3.2
- Opera 9.6
Recommended Posts:
- CSS | ::before selector
- CSS | ::after Selector
- CSS | * Selector
- CSS | :not Selector
- CSS | #id Selector
- CSS | Class Selector
- CSS | ::first-letter Selector
- CSS | ::first-line Selector
- CSS | [attribute$=value] Selector
- CSS | :nth-last-child() Selector
- CSS | :nth-child() Selector
- CSS | :indeterminate Selector
- CSS | optional Selector
- CSS | :target Selector
- CSS | :first-of-type Selector
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




