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!The post Case Insensitive CSS Attribute Selector appeared first on David Walsh Blog.
https://tkjs.us/dwb
https://davidwalsh.name/css-attribute-case
