Using Style Sheets in XHTML

There are several ways to use style sheets in XHTML. As we already saw in this chapter, you can use the <link> element to connect an external style sheet to a document, like this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/tr/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
        <title>
            Working With External Style Sheets
        </title>
        <link rel="stylesheet" href="style.css">
    </head>
    
<body>
       <center>
           <h1>
               Working With External Style Sheets
           </h1>

           <p>
           This document is displayed using an external style sheet.
           </p>
       </center>
    </body>
</html>
				

This XHTML links the Web page to an external style sheet named style.css, written in CSS ...

Get Inside XML 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.