12.2. Styles and HTML

For a tangible example using XHTML, consider the following code:

<p><b><u>Heading One</u></b></p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud
exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
<p><b><u>Heading Two</u></b></p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud
exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
<p><b><u>Heading Three</u></b></p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud
exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>

For the purpose of this example, ignore the fact that most of the text formatting tags (underline, center, and so on) have been deprecated.

Note that all three headings are coded bold and underlined. Now suppose that you wanted the headings to be larger and italic. Each heading would have to be recoded similar to the following:

<p><font size="+2"><i>Heading One</i></font></p>

Although using a decent editor with global search and replace makes this change pretty easy, consider managing an entire site, with several documents—if not tens or hundreds—each with several headings. Each document ...

Get Web Standards Programmer's Reference: HTML, CSS, JavaScript®, Perl, Python®, and PHP 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.