7

background is a valid colour in CSS. It differs per browser; it's a shade of purple in chromium. I can't find any information on it and was wondering why it exists and what it is.

.test {
  height: 200px;
  width: 200px;
  background-color: background;
}
<div class="test"></div>
jonrsharpe
  • 115,751
  • 26
  • 228
  • 437
Kalium
  • 81
  • 6
  • Interesting. For me, it shows as a dark red (#800000) in IE11 and firefox, but a bluish color (#6363CE) in Chrome. – dan04 Mar 23 '17 at 22:47
  • 1
    At first, I thought that this question could be a duplicate of http://stackoverflow.com/questions/8318911/why-does-html-think-chucknorris-is-a-color, but it isn't, because the letters BAC are absent from these hex codes. – dan04 Mar 23 '17 at 22:50
  • This is a duplicate !! If you look to the right, you will see "Related". – monstro Mar 26 '17 at 21:41
  • 1
    @monstro as the comment above says (and my answer makes clear by giving the actual reason), it's *not* a duplicate of that linked question. If `background` was being interpreted the same way as `chucknorris` it would: 1. be consistent between browsers; and 2. be `#ba000d`, not `#800000` or `#6363CE`. – jonrsharpe Mar 27 '17 at 08:11

1 Answers1

4

It refers to one of the CSS2 system colours, now deprecated.

Note that you get the same result with Background, as it's listed in that documentation; CSS is case insensitive, I think they're just listed in CamelCase to make the word boundaries clearer.

.test {
  height: 200px;
  width: 200px;
  background-color: Background;
}
<div class="test"></div>
jonrsharpe
  • 115,751
  • 26
  • 228
  • 437