attribute
Attribute Ends With Selector
Selects elements whose named attribute ends with the specified substring. Commonly used to target file extensions in href or src attributes.
[attr$="value"] Example
a[href$=".pdf"]::after { content: " (PDF)"; } /* HTML: <a href="file.pdf">Doc</a> */ ✓ Matches
- <a href="file.pdf">a</a>
- <a href="/docs/report.pdf">b</a>
- <a href="/documents/manual.pdf">c</a>
✗ Does not match
- <a href="file.pdf.html">a</a>
- <a href="file.png">b</a>
Browser support
Universal support in all browsers since CSS3.