43

I quite like the look of the font used in the code blocks that appear on Stack Overflow.

What, dear listener, is the font face used for such?

migrated from stackoverflow.com Jan 19 '10 at 2:53

This question came from our site for professional and enthusiast programmers.

63

It's the first font in the following list that is installed on your system:

  • Consolas
  • Monaco
  • Lucida Console
  • Liberation Mono
  • DejaVu Sans Mono
  • Bitstream Vera Sans Mono
  • Courier New

For more information, look at the CSS file in Firebug.

  • 4
    +1 It's good to make the point that it depends on what fonts are installed in the client. – pavium Jan 19 '10 at 4:53
  • 1
    and the browser defined ones... – juanm55 Jul 9 '12 at 16:34
18
code {
  background-color:#EEEEEE;
  font-family:Consolas,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New;
}
  • 1
    No monospace? I am disappoint. – Ignacio Vazquez-Abrams Jan 19 '10 at 2:48
  • Edited and fixed ;) – schnaader Jan 19 '10 at 2:48
  • 2
    @Ignacio: There's a reason monospace isn't used, and that reason is WebKit, which renders it differently than all other browsers. – John Rudy Jan 19 '10 at 14:40
7

See Super User:

  • 1
    Careful, Arjan, you are currently implying that there would be useful information on SU? That would be shocking! – Gnoupi Jan 19 '10 at 8:46
  • 3
    @Gnoupi, you know how all the questions that are too difficult for SO are delegated to SU. ;-) – Arjan Jan 19 '10 at 9:51

You must log in to answer this question.