4 ms·
Tell HN: CSS class selectors may become case (in)sensitive
I discovered this behavior in chrome in an unfortunately long debugging session and maybe this saves someone time: When the encoding of a page is set to utf-8 in the http content type header, chrome treats css class selectors as case sensitive, but when utf-8 is declared in the !DOCTYPE header of the html file, they become case insensitive.
Curious if there is a back story of some spec that explains this or if this is just a random inconsistency
- bhaney 2y agoClass names are considered case sensitive in HTML, and CSS selectors honor this except when in quirks mode. I suspect you're activating quirks mode when you mess with the doctype, causing the matching behavior to become case insensitive. This should be the same in Firefox as well, but I haven't tested it.