English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
Represents an element with an attribute named attribute and a value ending with "value".
Complete CSS Selector Reference Manual
An <a> element with a href attribute and a value ending with ".org", as follows selection:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Basic Tutorial(oldtoolbag.com)</title> <style> /* An <a> element with a href attribute and a value ending with ".org", as follows selection */ a[href$=".org"] { color: red; } </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 ‹/›
[attribute$=value] Selector to match elements whose attribute values end with the specified value.
IEFirefoxOperaChromeSafari
All mainstream browsers support[attribute$=value] Selector.
Note: [attribute$=value]in IE8Running in the environment, it must declare<!DOCTYPE> 。
Set the background color of all elements with a class attribute value ending with "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 ‹/›