Attribute Selector
Attribute Selector is a CSS property in the Selectors category. Patterns for selecting and matching HTML elements. The syntax is [attr=value] { /* styles */ }. A typical example: input[type="text"] { border: 1px solid #ccc; } It is commonly applied to markup such as <div class="demo">Sample</div> Browser support: Chrome 1+, Firefox 1+, Safari 1+, Edge 12+. A close relative is Type Selector, which patterns for selecting and matching HTML elements. A close relative is Class Selector, which patterns for selecting and matching HTML elements. A close relative is ID Selector, which patterns for selecting and matching HTML elements. More about this category: CSS selectors for targeting HTML elements by type, class, and attributes. Related Selectors entries: Type Selector, Class Selector, ID Selector, Universal Selector, Descendant Combinator, Child Combinator, Adjacent Sibling, General Sibling. This page is part of the free CSS Reference documentation covering 841+ properties, selectors, functions, and at-rules, each with syntax, values, examples, and browser support.