Examples

Let’s put what we know to use now and format a document with CSS. XHTML is a good place to start, so let’s take the document in Example 3-4. To maximize the possibilities for formatting it, we should add some structure with div elements, and use span elements to increase the granularity of inlines. Example 5-1 is the improved result.

Example 5-1. An XHTML document with DIVs and SPANs
<html> <head> <title>CAT(1) System General Commands Manual</title> <link rel="stylesheet" type="text/css" href="style1.css" /> </head> <body> <h1>CAT(1) System General Commands Manual</h1> <div class="section"> <h2>NAME</h2> <p>cat - concatenate and print files</p> </div> <div class="section"> <h2>SYNOPSIS</h2> <p class="code">cat [-benstuv] [-] [<em>file</em>...]</p> </div> <div class="section"> <h2>DESCRIPTION</h2> <p> The <span class="command">cat</span> utility reads files sequentially, writing them to the standard output. The file operands are processed in command line order. A single dash represents the standard input. </p> <p> The options are as follows: </p> <dl> <dt><span class="option">-b</span></dt> <dd> Implies the <span class="option">-n</span> option but doesn't number blank lines. </dd> <dt><span class="option">-e</span></dt> <dd> Implies the <span class="option">-v</span> option, and displays a dollar sign (<span class="symbol">$</span>) at the end of each line as well. </dd> <dt><span class="option">-n</span></dt> <dd>Number the output lines, starting at 1.</dd> <dt><span class="option">-s</span></dt> ...

Get Learning XML, 2nd Edition 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.