CSS Selector Level 4 » Attribute case-sensitivity

The attribute case-sensitivity selector is mostly equivalent to the CSS2 attribute selector but with the difference set the case-(in)sensitive within the ASCII range. i selects an element using the given attribute value in case-insensitive mode. s sets the given attribute value to be case-sensitive. By default, the selector is case-sensitive but it depends on the document language.

# Syntax

Copy
[attribute="value" i] {
    /* declarations */
}

[attribute="value" s] {
    /* declarations */
}

# Example

Copy
a[href$="pdf" i] {
    color: red;
}

Here it's possible to select all links which have an href attribute with the case-insensitive ending pdf (e.g. PDF, pdf or even pDf).

Try example in CodePen

# Browser support

Platform Chrome Firefox Safari Edge Internet Explorer Opera
Desktop Yes (49) Yes (47) Yes (9) Yes (79) No Yes (36)
Mobile Yes (59) Yes (54) Yes (9.2) Yes (79) No Yes (37)

# Usage statistics (Alexa Top 1,250,000 sites)

Due to an extreme price increase of our statistics provider the data collection was stopped in September 2018.


Please wait a moment, the comments start loading now...
explorermozillachromesafariopera info external