Force a fixed width font?

I have some pages that contain source code that should be displayed in a fixed width font. I initially used Bitstream Vera Sans Mono, but when I tested the site from a Windows machine using Firefox and IE, the font was converted to variable width. I changed to one of the Web fonts, Andale Mono, but found the same behavior on Firefox, IE, and Chrome.

How do I configure a text box to display a preferred fixed width font and fail back to an available fixed width font if the specified one isn't available?

Thanks,

Patrick

PowerBook (PPC), Mac OS X (10.5.5)

Posted on Nov 1, 2008 3:43 PM

Reply
11 replies

Nov 22, 2008 1:57 AM in response to Patrick J. May

Are you using CSS? If so you would do it like this;

font-family: "Bitstream Vera Sans Mono","Courier New", monospace;

That tells the browser to use Vera Sans if it is installed, if it isn't it will try to use Courier New, and if that isn't installed it will use the browser's default monospace font.

Note that you only need to enclose the font name in quotes if there are spaces in the name, so you wouldn't need to wrap Arial in quotes.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Force a fixed width font?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.