Case Insensitive CSS Attribute Selector


CSS selectors by no means stop to amaze me in how highly effective they are often in matching advanced patterns. Most of that flexibility is in mother or father/youngster/sibling relationships, very seldomly in worth matching. Think about my shock once I realized that CSS permits matching attribute values regardless off case!

Including a {house}i to the attribute selector brackets will make the attribute worth search case insensitive:

/* case delicate, solely matches "instance" */
[class=example] {
  background: pink;
}

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

The use circumstances for this i flag are doubtless very restricted, particularly if this flag is knew data for you and also you’re used to a regular lower-case commonplace. A unfastened CSS classname commonplace could have and would proceed to result in issues, so use this case insensitivity flag sparingly!

  • Interview with a Pornhub Web Developer
  • Creating Scrolling Parallax Effects with CSS

    Introduction For fairly a very long time now web sites with the so known as “parallax” impact have been actually widespread. In case you haven’t heard of this impact, it mainly consists of completely different layers of photographs which are transferring in numerous instructions or with completely different pace. This results in a…


Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *