The Consolas font, which the CSS sets as the preferred font for the code blocks on Stack Overflow, looks exceedingly terrible on my machine (it's my favourite font on Windows, but on Linux... blech).

It would be really helpful (to me anyway) if somewhere on the site I could change the font for code blocks, so that the font I specified would become the preferred font for code blocks. My eyes would be grateful.

  • 1
    What about this? ;-) Nov 13, 2011 at 18:59
  • @ShadowWizard I don't exactly want a hot-dog themed meta, but if you take away everything but the font specification, it looks like the right thing. How do you use it? Nov 13, 2011 at 19:04
  • Not sure, never done that myself but this look promising. :) Nov 13, 2011 at 19:09
  • @ShadowWizard oh, I use Chrome :) Nov 13, 2011 at 19:13
  • 2
    Stylish for Chrome or put the CSS in your Default/User Stylesheets/Custom.css file @SethCarnegie.
    – Mat
    Nov 13, 2011 at 19:14
  • @Mat that's exactly what I was looking for. If you want to add that as an answer I'll upvote and accept. Nov 13, 2011 at 19:20
  • @SethCarnegie: You might also want to check out superuser and/or Unix & Linux to get your font fixed :)
    – Mat
    Nov 13, 2011 at 19:32
  • @Mat nah, I've already gotten used to Droid Sans Mono. I know what the problem is though, but I can't fix it because of a series of unfortunate dependencies. Thanks again. Nov 13, 2011 at 19:37
  • 1
    If Consolas is that ugly, why not remove it entirely? Like on these sites the CSS will then fall back to the next from the list: font-family: Consolas, Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace, serif. Not your first choice indeed, so the user stylesheet is a better fix. But other sites will probably have similar fallbacks defined.
    – Arjan
    Nov 13, 2011 at 20:33

1 Answer 1


All you need for that is a user stylesheet with something like the following:

#mainbar code {
    font-family: Serif !important;

Serif might not be the best selection here :). The #mainbar selector should make it match all over SE, and hopefully not too much elsewhere.

For Chrome, you need to put that in your Default/User Stylesheets/Custom.css file. (Not sure where that lives on Windows. On Linux, should be under ~/.config/chrome.)

Given that most modern browsers let you have user stylesheets, and that extensions for doing things like this exist (like http://userstyles.org for instance, with Stylish for Chrome, plugin also exists for Firefox), I don't think there is enough justification to having per-user settings for this.

If you give the option just for the code-block font, someone's going to ask for some other font tunable, or color, or spacing, or... and that's probably going to end up being a QA nightmare.

  • Brilliant, thanks. FWIW, it's Droid Sans Mono :) Nov 13, 2011 at 19:31
  • So, @Seth, is this still a feature request? If not, please retag it as support.
    – Arjan
    Nov 13, 2011 at 20:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .