Chapter 4. Basic (X)HTML Formatting

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 in this chapter is because CSS is sometimes too big a bazooka for the job. If you want to highlight a word or phrase on your page, instead of enclosing it in a span element with a particular class and then creating a style sheet for that class, you can just wrap it in a simple formatting element and be done with it.

There are a number of formatting elementsfor changing the font, size, and color, for examplethat, while still technically legal and widely supported, are being phased out of (X)HTML in favor of style sheets. You can find more information about them in Appendix A, (X)HTML Reference as well as on my Web site (see page 25).

HTML, XHTML, & CSS(c) Visual QuickStart Guide
HTML, XHTML, and CSS, Sixth Edition
ISBN: 0321430840
EAN: 2147483647
Year: 2004
Pages: 340

Similar book on Amazon © 2008-2017.
If you may any questions please contact us: