Using CSS
Styles can be used at three levels:
- In a separate style sheet linked to (X)HTML pages
- In a style element in the head of the (X)HTML page
- In a style attribute within specific (X)HTML elements
/* melville.css style sheet */
body { font-family: verdana, helvetica, sans-serif;
background: #f1f1f1;
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Moby Dick, or, The Whale</title>
<link rel="stylesheet" href="melville.css"
type="text/css" />
<style type="text/css">
<!--
h1 { font-style: italic; }
-->
</style>
</head>
<body>
<div style="text-align: center;
width: 70%; border: solid black 1px;">
<h2>About "Moby Dick, or, The Whale"</h1>
<p>This story of a obsessive sea captain's quest to
<span style="color: red;">find and destroy<span>
an extraordinary whale that had taken his leg in a
previous encounter is sometimes seen as an allegory
for all of humanity's obsessive pursuits.
</p>
</div>
<h1>Moby Dick, or, The Whale</h1>
<p>Call me Ishmael. Some years ago —
never mind how long precisely — having
little or no money in my purse, and nothing
particular to interest me on shore, I thought
I would sail about a little and see the watery
part of the world.</p>
</body>
</html>