Case Insensitive CSS Attribute Selector

Date:

Share post:

CSS selectors never cease to amaze me in how powerful they can be in matching complex patterns. Most of that flexibility is in parent/child/sibling relationships, very seldomly in value matching. Consider my surprise when I learned that CSS allows matching attribute values regardless off case!

Adding a {space}i to the attribute selector brackets will make the attribute value search case insensitive:

/* case sensitive, only matches "example" */
[class=example] {
  background: pink;
}

/* case insensitive, matches "example", "eXampLe", etc. */
[class=example i] {
  background: lightblue;
}

The use cases for this i flag are likely very limited, especially if this flag is knew knowledge for you and you’re used to a standard lower-case standard. A loose CSS classname standard will have and would continue to lead to problems, so use this case insensitivity flag sparingly!

Request Metrics real user monitoring

Source link
spot_img

Related articles

A new campaign by the ForumTroll APT group

Introduction In March 2025, we discovered Operation ForumTroll, a series of sophisticated cyberattacks exploiting the CVE-2025-2783 vulnerability in Google...

Rumored Ryzen 7 9850X3D spotted on popular benchmark suite

New data solidifies claims of a Ryzen 7 9850X3D chip Updated: Dec 5, 2025...

What is Enterprise Commerce? Custom Solution or Ready-Made?

Finding the right e-commerce platform is the first...

Tesla used deceptive language to market Autopilot, California judge rules

Tesla’s sales in California should be suspended for 30 days because its marketing around Autopilot and Full Self-Driving...