4. Basic (X)HTML Formatting

While it’s a good idea to try to separate formatting from content and to use style sheets for controlling the appearance of your page, there are a few simple ways to format text in (X)HTML that are handy to know.

When should you use basic (X)HTML formatting instead of CSS? There are two main situations. First, most of the elements discussed in this chapter are logical elements, that is, they give structure to your document by describing what they contain. For example, the code element is specifically designed for formatting lines of code from a script or program. While it formats such content in a monospace font, it also more importantly identifies the text as code.

The second reason to use the basic formatting elements ...

Get HTML, XHTML, & CSS, Sixth Edition: Visual QuickStart Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.