CSS Attribute Selector | CSS attribute selector
StyleHTMLElementsWithSpecificAttributesItispossibletostyleHTMLelementsthathavespecificattributesorattributevalues.CSS[attribute]SelectorThe[attribute]selectorisusedtoselectelementswithaspecifiedattribute.Thefollowingexampleselectsallelementswithatargetattribute:CSS[attribute="value"]SelectorThe[attribute="value"]selectorisusedtoselectelementswithaspecifiedattributeandvalue.Thefollowingexampleselectsallelementswithatarget="_blank"attribute:CSS[attribute~="value"]SelectorThe[...
Style HTML Elements With Specific AttributesIt is possible to style HTML elements that have specific attributes or attribute values.
CSS [attribute] SelectorThe [attribute] selector is used to select elements with a specified attribute.
The following example selects all <a> elements with a target attribute:
CSS [attribute="value"] SelectorThe [attribute="value"] selector is used to select elements with a specified attribute and value.
The following example selects all <a> elements with a target="_blank" attribute:
CSS [attribute~="value"] SelectorThe [attribute~="value"] selector is used to select elements with an attribute value containing a specified word.
The following example selects all elements with a title attribute that contains a space-separated list of words, one of which is "flower":
The example above will match elements with title="flower", title="summer flower", and title="flower new", bu...