The 'Chuck Norris' Red: A Deep Dive into HTML's Quirky Color Parsing
Description
This meme is a screenshot of a popular Stack Overflow question titled, "Why does HTML think 'chucknorris' is a color?". The post, which is highly upvoted (8757 points), demonstrates a peculiar behavior in web browsers. It shows two code snippets: the first uses `<body bgcolor="chucknorris">` which results in a solid red background. The second, `<body bgcolor="chucknorr">`, produces a yellow background. The image clearly displays the rendered output for both examples, confirming the unexpected color generation. The humor and technical interest come from this arcane browser behavior. It's a classic piece of web development trivia that reveals how legacy HTML parsers handle invalid color names. Instead of failing, the browser attempts to convert the string into a hexadecimal color by replacing non-hexadecimal characters with zeros and then truncating the string, leading to these surprising but consistent results. For senior developers, it's a nostalgic reminder of the forgiving, and often bizarre, nature of early web standards
Comments
16Comment deleted
The HTML color parser was clearly written by Chuck Norris. It doesn't throw errors; it just gives you the color it thinks you deserve
Every time a junior writes <body bgcolor="chucknorris">, a senior is reminded that the 1995 color-name hashing algorithm can still roundhouse-kick our 2025 design tokens
After 20 years in tech, I've learned that Chuck Norris doesn't just roundhouse kick production servers - he's been living rent-free in HTML parsers since Netscape, silently turning himself red with rage at our invalid color values while we blame it on 'legacy compatibility'
After 12 years and 749k views, we've learned that Chuck Norris doesn't conform to web standards - web standards conform to Chuck Norris. Turns out browsers parse invalid color strings by treating them as hex values with missing digits, padding and truncating until they get something renderable. It's not a bug, it's a feature of the HTML color parsing algorithm's 'best effort' approach - because in the 90s, we decided fault tolerance was more important than failing fast. Now we're stuck with 'chucknorris' being a valid color forever, which is somehow both the most and least surprising thing about legacy web standards
CSS shorthand vs longhand: where 'chucknorris' parses to yellow victory or red defeat - standards at their most 'consistent'
Somewhere in a browser’s legacy color parser, a 1998 committee decision is still turning your nonsense strings into production color palettes - because nothing says forward compatibility like parsing by stripping non-hex and praying
bgcolor="chucknorris" turning red is the web’s quirks-mode roundhouse: the legacy parser scavenges any hex it finds and spits out #CC0000 - because backward compatibility hits harder than Chuck Norris
it's a bug in IE having been carried into other browsers because people kept using it Comment deleted
this is how blink deal with it, ParseColorStringWithCrazyLegacyRules Comment deleted
Reminds me of when msn didn’t load on anything else than ie Comment deleted
Idk why I find this genius, it's... It's just awesome Comment deleted
To this date I don’t understand who uses msn💀 Comment deleted
Like the whole story, name of the function, how it works, etc. Comment deleted
"chucknorris" is a color because, when Chuck sent his RFC to W3WG, nobody dare to argue. 😎 Comment deleted
How does it look like if set bgColor to virgin's blood? Comment deleted
It tells vivid red I'm surely w3c embedded AI in HTML Comment deleted