Using a Monospaced FontEvery visitor to your page has two fonts specified in their browser's preferences: one regular, proportionally spaced one, and the other monospaced, like a typewriter's text. These are usually Times and Courier, respectively. If you are displaying computer codes, URLs, or other information that you wish to offset from the main text, you might want to format the text with the monospaced font. Use code for formatting computer code in languages like C or Perl. The tt element (it stands for typewriter text) is for general monospaced text. Use kbd for formatting keyboard instructions. And samp is for displaying sample text. None of these tags is used very often. The truth is that monospaced text is kind of ugly. To format text with a monospaced font:
Figure 4.6. The code element not only formats its contents with a monospaced font but also indicates that the contents are computer code. It's a logical g tag.
Figure 4.7. Monospaced text is perfect for URLs and computer code.
Figure 4.8. Text tagged with code, kbd, samp, or tt will be displayed in the font that your visitors have chosen for monospaced text in their browser. The Fonts box from IE 7 (shown) comes up when you choose Tools > Internet Options and then click the Fonts button in the General tab.
Tips
|