Monospaced font sizes

| Tagged: css, fonts.

In a few of the Wolf themes I’ve ported, I have noticed that sometimes the “code” examples are inexplicably smaller than their context. I shrugged, and didn’t think too much more about it, although it was irksome.

Irksome … until I stumbled across a fascinating article by Eric Meyer on Fixed Monospace Sizing. The bottom line is that the CSS declaration of a monospaced font needs to include a “serif” or “sans-serif” generic declaration at the end of the definition; leaving it simply at “monospace” gets you apparent browser weirdness. (See the article for the gory details!) Something like this is what is needed, then:

font-family: Consolas, monospace, serif; font-size: 1em;

It’s worth noting, too, that Meyer stands by using “em” rather that “px” for sizing. But I reckon I should go back through my ported-to-Wolf themes and make them prettier!

There are zero comments:

Please insert the result of the arithmetical operation from the following image:

Please insert the result of the arithmetical operation from this image. =

Note: comments are moderated; spam will be deleted.

This page last updated: Sat, 3 Aug 2013.

If you wish to help out Wolf CMS financially, please use our PayPal button, or consider making weekly, recurring contributions through our account.
Thank you!


Batch files Bookmarks Code Colour Comments Css Favicons Firefox addon Fonts Google Helpers History I18n Info Lubuntu Plugins Snippets Source Svn Themes Tips Tutorial Upgrade Utf-8 Web apps Wolf CMS Wolftags Wörter Волк الذئب ウルフ