Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • \$\begingroup\$ Is this browser/version dependent? If yes, better specify it. In Firefox 88.0 looks a bit different: i.sstatic.net/aQnLo.png \$\endgroup\$ Commented Jun 28, 2021 at 21:02
  • \$\begingroup\$ @manatwork thanks for drawing my attention to this. I wasn't expecting browser dependency. \$\endgroup\$ Commented Jun 28, 2021 at 21:06
  • \$\begingroup\$ After some investigation, it looks like Firefox defaults to display:inline and Chrome/Edge forces inline-block (ignoring any display we specify). Putting display:inline-block makes both the same (but for golf, display:block is shorter). After some experimentation, my best cross-browser is then console.log(...["f00","f80","ff0","0f0","00f","808"].reduce((a,c)=>{a[0]+='%c ';return[...a,`background:#${c};display:block;padding:2%26%`]},[''])) For just Firefox we can remove the padding, for just Chrome/Edge we can remove the display. \$\endgroup\$ Commented Jun 30, 2021 at 22:43