Skip to content
techsnow

CSS Selectors

Attribute Selectors

Select elements based on their attributes.

SelectorSelects
[disabled]Elements that have the attribute
[type="email"]Exact value
[href^="https"]Value starts with
[href$=".pdf"]Value ends with
[class*="btn"]Value contains
input[type="email"] { border-color: teal; }
a[href$=".pdf"]::after { content: " (PDF)"; }
a[target="_blank"] { text-decoration: underline dotted; }