HTML and CSS Reference
In-Depth Information
You can apply this rule in one of three places:
A style attribute on the element itself
A style element in the document's head
An external CSS stylesheet
The last option is usually the best. It enables you to share styles across documents, which maintains a
consistent look and feel for the site as well as reducing bandwidth requirements. However, we'll often use the
first two as intermediate steps while working up to fully external stylesheets. Furthermore, I will sometimes
demonstrate a technique with an inline style here just to keep the examples reasonably short.
Tidy will define replacement CSS classes and rules if you ask it to with the -clean option. Then it will put them
in the head. For example, it changes this:
<html>
<head>
<title>Wet Willy's Wonderland!</title>
</head>
<body>
<h1> <center> Wet Willy's Wonderland! </center> </h1>
into this:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Wet Willy's Wonderland!</title>
<style type="text/css">
/*<![CDATA[*/
div.c1 {text-align: center}
/*]]>*/
</style>
</head>
<body>
<div class="c1">
<h1>Wet Willy's Wonderland!</h1>
</div>
However, the names it chooses aren't especially meaningful, and it can't distinguish among different reasons for
the center element. Furthermore, it may introduce unnecessary div s, as it did here. What you'd really like in
this case is something more like this:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Wet Willy's Wonderland!</title>
<style type="text/css">
Search WWH ::




Custom Search