English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

CSS Reference Manual

CSS @rules

Comprehensive list of CSS properties

CSS3 [attribute*=value] selector

Represents an element that has an attribute named attribute and whose attribute value contains "value".

Complete CSS Selector Reference Manual

Online Example

The <a> element that exists with the href attribute and whose attribute value contains "example", as follows selected:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Basic Tutorial(oldtoolbag.com)</title>
<style>
/* The <a> element that exists with the href attribute and whose attribute value contains "example", as follows selected */
a[href*="example"] {
  font-size: 2em;
}
</style>
</head>
<body>
<div>
<ul>
  <li><a href="#internal">Internal link</a></li>
  <li><a href="http://example.com">Example link</a></li>
  <li><a href="#InSensitive">Insensitive internal link</a></li>
  <li><a href="http://example.org">Example org link</a></li>
</ul>
</div>
</body>
</html>
Test and See ‹/›

Definition and Usage

[attribute*=value] selector matches elements whose attribute values contain the specified values.

Browser Compatibility

IEFirefoxOperaChromeSafari

All mainstream browsers support[attribute*=value] s selector.

Note: [attribute*=value] in IE8Running in the environment, it is necessary to declare <!DOCTYPE>

Online Example

Set the background color of all elements with the class attribute value containing "test":

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"> 
<title>Basic Tutorial(oldtoolbag.com)</title> 
<style> 
[class*="test"]
{
background:#ffff00;
}
</style>
</head>
<body>
<div class="first_test">Section1A DIV element.</div>
<div class="second">Section2A DIV element.</div>
<div class="test">Section3A DIV element.</div>
<p class="test">This is a common text paragraph.</p>
</body>
</html>
Test and See ‹/›

Complete CSS Selector Reference Manual