Monospace font size fix
I remember that when writing the stylesheet for this website I had
issues sizing the monospace font used for code snippets. Most
usually it would show up very small compared to the rest of the text
even though I wouldn’t set it to another font-
. That would
happen only for the plain monospace
font, not any other webfont or
named font. Today I came across this webpage recommending the
following CSS properties to fix the monospace font’s sizing on all
browsers.
font-family: monospace, monospace; font-size: 1em;
Sure enough, monospaced text renders with a much more harmonious size when its font is set to ~monospace, monospace~… Sadly I can’t find a straight answer as to why this works.