{"id":3855,"date":"2022-08-20T20:12:06","date_gmt":"2022-08-20T14:42:06","guid":{"rendered":"https:\/\/jassweb.com\/solved\/solved-why-does-html-think-chucknorris-is-a-color\/"},"modified":"2022-08-20T20:12:06","modified_gmt":"2022-08-20T14:42:06","slug":"solved-why-does-html-think-chucknorris-is-a-color","status":"publish","type":"post","link":"https:\/\/jassweb.com\/solved\/solved-why-does-html-think-chucknorris-is-a-color\/","title":{"rendered":"(Solved) Why does HTML think \u201cchucknorris\u201d is a color?"},"content":{"rendered":"<p> [ad_1]<br \/>\n<\/p>\n<div id=\"answer-8333464\" class=\"answer js-answer accepted-answer js-accepted-answer\" data-answerid=\"8333464\" data-parentid=\"8318911\" data-score=\"7887\" data-position-on-page=\"1\" data-highest-scored=\"1\" data-question-has-accepted-highest-score=\"1\" itemprop=\"acceptedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n<div class=\"post-layout\">\n<div class=\"votecell post-layout--left\"><\/div>\n<div class=\"answercell post-layout--right\">\n<div class=\"s-prose js-post-body\" itemprop=\"text\">\n<p>It\u2019s a holdover from the Netscape days:<\/p>\n<blockquote>\n<p>Missing digits are treated as 0[&#8230;]. An incorrect digit is simply interpreted as 0. For example the values #F0F0F0, F0F0F0, F0F0F, #FxFxFx and FxFxFx are all the same.<\/p>\n<\/blockquote>\n<p>It is from the blog post <em><a rel=\"nofollow noopener\" target=\"_blank\" href=\"http:\/\/scrappy-do.blogspot.com\/2004\/08\/little-rant-about-microsoft-internet.html\">A little rant about Microsoft Internet Explorer&#8217;s color parsing<\/a><\/em> which covers it in great detail, including varying lengths of color values, etc.<\/p>\n<p>If we apply the rules in turn from the blog post, we get the following:<\/p>\n<ol>\n<li>\n<p>Replace all nonvalid hexadecimal characters with 0\u2019s:<\/p>\n<pre><code>chucknorris becomes c00c0000000\n<\/code><\/pre>\n<\/li>\n<li>\n<p>Pad out to the next total number of characters divisible by\u00a03 (11\u00a0\u2192 12):<\/p>\n<pre><code>c00c 0000 0000\n<\/code><\/pre>\n<\/li>\n<li>\n<p>Split into three equal groups, with each component representing the corresponding colour component of an RGB colour:<\/p>\n<pre><code>RGB (c00c, 0000, 0000)\n<\/code><\/pre>\n<\/li>\n<li>\n<p>Truncate each of the arguments from the right down to two characters.<\/p>\n<\/li>\n<\/ol>\n<p>Which, finally, gives the following result:<\/p>\n<pre><code>RGB (c0, 00, 00) = #C00000 or RGB(192, 0, 0)\n<\/code><\/pre>\n<p>Here\u2019s an example demonstrating the <code>bgcolor<\/code> attribute in action, to produce this \u201camazing\u201d colour swatch:<\/p>\n<\/p>\n<div class=\"snippet\" data-lang=\"js\" data-hide=\"false\" data-console=\"false\" data-babel=\"false\">\n<div class=\"snippet-code\">\n<pre class=\"snippet-code-html lang-html prettyprint-override\"><code>&lt;table&gt;\n  &lt;tr&gt;\n    &lt;td bgcolor=\"chucknorris\" cellpadding=\"8\" width=\"100\" align=\"center\"&gt;chuck norris&lt;\/td&gt;\n    &lt;td bgcolor=\"mrt\"         cellpadding=\"8\" width=\"100\" align=\"center\" style=\"color:#ffffff\"&gt;Mr T&lt;\/td&gt;\n    &lt;td bgcolor=\"ninjaturtle\" cellpadding=\"8\" width=\"100\" align=\"center\" style=\"color:#ffffff\"&gt;ninjaturtle&lt;\/td&gt;\n  &lt;\/tr&gt;\n  &lt;tr&gt;\n    &lt;td bgcolor=\"sick\"  cellpadding=\"8\" width=\"100\" align=\"center\"&gt;sick&lt;\/td&gt;\n    &lt;td bgcolor=\"crap\"  cellpadding=\"8\" width=\"100\" align=\"center\"&gt;crap&lt;\/td&gt;\n    &lt;td bgcolor=\"grass\" cellpadding=\"8\" width=\"100\" align=\"center\"&gt;grass&lt;\/td&gt;\n  &lt;\/tr&gt;\n&lt;\/table&gt;<\/code><\/pre>\n<\/div>\n<\/div>\n<p>This also answers the other part of the question: Why does <code>bgcolor=\"chucknorr\"<\/code> produce a yellow colour? Well, if we apply the rules, the string is:<\/p>\n<pre><code>c00c00000 =&gt; c00 c00 000 =&gt; c0 c0 00 [RGB(192, 192, 0)]\n<\/code><\/pre>\n<p>Which gives a light yellow gold colour. As the string starts off as 9\u00a0characters, we keep the second\u00a0\u2018C\u2019 this time around, hence it ends up in the final colour value.<\/p>\n<p>I originally encountered this when someone pointed out that you could do <code>color=\"crap\"<\/code> and, well, it comes out brown.<\/p>\n<\/p><\/div>\n<div class=\"mt24\"><\/div>\n<\/div>\n<p>            <span class=\"d-none\" itemprop=\"commentCount\">4<\/span> <\/p><\/div>\n<\/div>\n<p>[ad_2]<\/p>\n<p>solved Why does HTML think \u201cchucknorris\u201d is a color? <\/p>\n","protected":false},"excerpt":{"rendered":"<p>[ad_1] It\u2019s a holdover from the Netscape days: Missing digits are treated as 0[&#8230;]. An incorrect digit is simply interpreted as 0. For example the values #F0F0F0, F0F0F0, F0F0F, #FxFxFx and FxFxFx are all the same. It is from the blog post A little rant about Microsoft Internet Explorer&#8217;s color parsing which covers it in &#8230; <a title=\"(Solved) Why does HTML think \u201cchucknorris\u201d is a color?\" class=\"read-more\" href=\"https:\/\/jassweb.com\/solved\/solved-why-does-html-think-chucknorris-is-a-color\/\" aria-label=\"More on (Solved) Why does HTML think \u201cchucknorris\u201d is a color?\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[320],"tags":[385,384,346],"class_list":["post-3855","post","type-post","status-publish","format-standard","hentry","category-solved","tag-background-color","tag-browser","tag-html"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>(Solved) Why does HTML think \u201cchucknorris\u201d is a color? - JassWeb<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/jassweb.com\/solved\/solved-why-does-html-think-chucknorris-is-a-color\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"(Solved) Why does HTML think \u201cchucknorris\u201d is a color? - JassWeb\" \/>\n<meta property=\"og:description\" content=\"[ad_1] It\u2019s a holdover from the Netscape days: Missing digits are treated as 0[&#8230;]. An incorrect digit is simply interpreted as 0. For example the values #F0F0F0, F0F0F0, F0F0F, #FxFxFx and FxFxFx are all the same. It is from the blog post A little rant about Microsoft Internet Explorer&#8217;s color parsing which covers it in ... Read more\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jassweb.com\/solved\/solved-why-does-html-think-chucknorris-is-a-color\/\" \/>\n<meta property=\"og:site_name\" content=\"JassWeb\" \/>\n<meta property=\"article:published_time\" content=\"2022-08-20T14:42:06+00:00\" \/>\n<meta name=\"author\" content=\"Kirat\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Kirat\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/solved-why-does-html-think-chucknorris-is-a-color\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/solved-why-does-html-think-chucknorris-is-a-color\\\/\"},\"author\":{\"name\":\"Kirat\",\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/#\\\/schema\\\/person\\\/65c9c7b7958150c0dc8371fa35dd7c31\"},\"headline\":\"(Solved) Why does HTML think \u201cchucknorris\u201d is a color?\",\"datePublished\":\"2022-08-20T14:42:06+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/solved-why-does-html-think-chucknorris-is-a-color\\\/\"},\"wordCount\":245,\"publisher\":{\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/#organization\"},\"keywords\":[\"background-color\",\"browser\",\"html\"],\"articleSection\":[\"Solved\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/solved-why-does-html-think-chucknorris-is-a-color\\\/\",\"url\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/solved-why-does-html-think-chucknorris-is-a-color\\\/\",\"name\":\"(Solved) Why does HTML think \u201cchucknorris\u201d is a color? - JassWeb\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/#website\"},\"datePublished\":\"2022-08-20T14:42:06+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/solved-why-does-html-think-chucknorris-is-a-color\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/jassweb.com\\\/solved\\\/solved-why-does-html-think-chucknorris-is-a-color\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/solved-why-does-html-think-chucknorris-is-a-color\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"(Solved) Why does HTML think \u201cchucknorris\u201d is a color?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/#website\",\"url\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/\",\"name\":\"JassWeb\",\"description\":\"Build High-quality Websites\",\"publisher\":{\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/#organization\",\"name\":\"Jass Web\",\"url\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/jassweb.com\\\/wp-content\\\/uploads\\\/2021\\\/02\\\/jass-website-logo-1.png\",\"contentUrl\":\"https:\\\/\\\/jassweb.com\\\/wp-content\\\/uploads\\\/2021\\\/02\\\/jass-website-logo-1.png\",\"width\":693,\"height\":132,\"caption\":\"Jass Web\"},\"image\":{\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/#\\\/schema\\\/person\\\/65c9c7b7958150c0dc8371fa35dd7c31\",\"name\":\"Kirat\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/wp-content\\\/litespeed\\\/avatar\\\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1777008400\",\"url\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/wp-content\\\/litespeed\\\/avatar\\\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1777008400\",\"contentUrl\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/wp-content\\\/litespeed\\\/avatar\\\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1777008400\",\"caption\":\"Kirat\"},\"sameAs\":[\"http:\\\/\\\/jassweb.com\"],\"url\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/author\\\/jaspritsinghghumangmail-com\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"(Solved) Why does HTML think \u201cchucknorris\u201d is a color? - JassWeb","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/jassweb.com\/solved\/solved-why-does-html-think-chucknorris-is-a-color\/","og_locale":"en_US","og_type":"article","og_title":"(Solved) Why does HTML think \u201cchucknorris\u201d is a color? - JassWeb","og_description":"[ad_1] It\u2019s a holdover from the Netscape days: Missing digits are treated as 0[&#8230;]. An incorrect digit is simply interpreted as 0. For example the values #F0F0F0, F0F0F0, F0F0F, #FxFxFx and FxFxFx are all the same. It is from the blog post A little rant about Microsoft Internet Explorer&#8217;s color parsing which covers it in ... Read more","og_url":"https:\/\/jassweb.com\/solved\/solved-why-does-html-think-chucknorris-is-a-color\/","og_site_name":"JassWeb","article_published_time":"2022-08-20T14:42:06+00:00","author":"Kirat","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Kirat","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jassweb.com\/solved\/solved-why-does-html-think-chucknorris-is-a-color\/#article","isPartOf":{"@id":"https:\/\/jassweb.com\/solved\/solved-why-does-html-think-chucknorris-is-a-color\/"},"author":{"name":"Kirat","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31"},"headline":"(Solved) Why does HTML think \u201cchucknorris\u201d is a color?","datePublished":"2022-08-20T14:42:06+00:00","mainEntityOfPage":{"@id":"https:\/\/jassweb.com\/solved\/solved-why-does-html-think-chucknorris-is-a-color\/"},"wordCount":245,"publisher":{"@id":"https:\/\/jassweb.com\/solved\/#organization"},"keywords":["background-color","browser","html"],"articleSection":["Solved"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/jassweb.com\/solved\/solved-why-does-html-think-chucknorris-is-a-color\/","url":"https:\/\/jassweb.com\/solved\/solved-why-does-html-think-chucknorris-is-a-color\/","name":"(Solved) Why does HTML think \u201cchucknorris\u201d is a color? - JassWeb","isPartOf":{"@id":"https:\/\/jassweb.com\/solved\/#website"},"datePublished":"2022-08-20T14:42:06+00:00","breadcrumb":{"@id":"https:\/\/jassweb.com\/solved\/solved-why-does-html-think-chucknorris-is-a-color\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jassweb.com\/solved\/solved-why-does-html-think-chucknorris-is-a-color\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/jassweb.com\/solved\/solved-why-does-html-think-chucknorris-is-a-color\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/jassweb.com\/solved\/"},{"@type":"ListItem","position":2,"name":"(Solved) Why does HTML think \u201cchucknorris\u201d is a color?"}]},{"@type":"WebSite","@id":"https:\/\/jassweb.com\/solved\/#website","url":"https:\/\/jassweb.com\/solved\/","name":"JassWeb","description":"Build High-quality Websites","publisher":{"@id":"https:\/\/jassweb.com\/solved\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/jassweb.com\/solved\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/jassweb.com\/solved\/#organization","name":"Jass Web","url":"https:\/\/jassweb.com\/solved\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/","url":"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png","contentUrl":"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png","width":693,"height":132,"caption":"Jass Web"},"image":{"@id":"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31","name":"Kirat","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1777008400","url":"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1777008400","contentUrl":"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1777008400","caption":"Kirat"},"sameAs":["http:\/\/jassweb.com"],"url":"https:\/\/jassweb.com\/solved\/author\/jaspritsinghghumangmail-com\/"}]}},"_links":{"self":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/posts\/3855","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/comments?post=3855"}],"version-history":[{"count":0,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/posts\/3855\/revisions"}],"wp:attachment":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/media?parent=3855"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/categories?post=3855"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/tags?post=3855"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}