8

Which font is used on Stack Overflow for code snippets?

Example:

var $div = $("#preloader");
$.each($.imgNames, function (i, val) {
    $("<img />").attr("src", $.largePath + val).addClass('PRELOADED').appendTo($div);
});
0

2 Answers 2

15

It depends what fonts are available on your system, but the list (in order of priority) is:

Consolas, Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace, serif

You can see this by inspecting one of the pre or code elements that contain formatted code (screenshot from Chrome's DOM inspector):

enter image description here

For more information on how that CSS behaves, you could look at the CSS Fonts module specification.

4

As of May 10, 2021 the font Stack Overflow, Inc. uses on Stack Overflow/Stack Exchange is as follows:

OS Sans Mono
macOS San Francisco San Francisco Mono
iOS San Francisco San Francisco Mono
Windows Segoe UI Consolas, or Cascadia Mono, Segoe UI Mono if you've installed those manually
Ubuntu Ubuntu Ubuntu Mono
Android Roboto Roboto Mono
Chrome OS Roboto Roboto Mono
Fallback sans-serif Menlo, Monaco, Consolas, monospace

From We are switching to system fonts on May 10, 2021

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