[CSS Selector] E[foo*="bar"]
Using 'selector[attribute*=value]', you can apply styles only to elements where a specific attribute's value contains the given string anywhere. This does not work in IE6 and below.
For example, if the value is function, it would match substrings like fu, unc, or ncti — anything that appears anywhere within the value.
Sample Code
p[title*=hoge] { color: red;} /* Applies to p elements whose title attribute value contains 'hoge' anywhere. */
p[title*=hoge1] { color: blue;} /* Applies to all p elements whose title attribute value contains 'hoge1' anywhere. */
[title*=Miku] { color: green;} /* Non-ASCII characters work here too. */
Browser Preview
p[title*=hoge] { color: red;} /* Applies to p elements whose title attribute value contains 'hoge' anywhere. */
p[title*=hoge1] { color: blue;} /* Applies to all p elements whose title attribute value contains 'hoge1' anywhere. */
[title*=Miku] { color: green;} /* Non-ASCII characters work here too. */
<p title="hoge">This is a p element. The title is set to 'hoge'.</p> <p title="hogehoge1 fuga">This is a p element. The title is set to 'hogehoge1 fuga'.</p> <p title="Hatsune-Miku and IA">This is a p element. The title attribute is set to 'Hatsune-Miku and IA'.</p>
Browser Compatibility
Desktop
2 and below ×Supported in all versions.
8 ○
7 ○
6 ×
8 and below ×Mobile
Android Browser
4.4+ ○
3 and below ×Same support as desktop.
Same support as desktop.
※ Version data is based on MDN.
If you find any errors or copyright issues, please contact us.