HTML and CSS Reference
In-Depth Information
Misspelled element and attribute names, for example,
<tabel>
instead of
<table>
-clean
The next important option is
-clean
. This replaces deprecated presentational elements such as
i
and
font
with
CSS markup. For example, when I used
-clean
on the same document, Tidy added these CSS rules to the head
of my document:
<style type="text/css">
/*<![CDATA[*/
body {
background-color: #fffffff;
color: #000000;
}
p.c2 {text-align: center}
h1.c1 {text-align: center}
/*]]>*/
</style>
It also added the necessary
class
attributes to the elements that had previously used a
center
element. For
example:
<h1 class="c1">Java Virtual Machines</h1>
That's as far as Tidy goes with CSS, but you might want to consider revisiting all these files to see if you can
extract a common external stylesheet that can be shared among the documents on your site, rather than
including the rules in each separate page. Furthermore, you should probably consider more semantic class
names rather than Tidy's somewhat prosaic default.
For example, I've sometimes used the
i
element to indicate that I'm
talking about
a word rather than
using
the
word. For example:
<p><i>May</i> can be very ambiguous in English, meaning might,
can, or allowed, depending on context.</p>
Here the italics are not used for emphasis, and replacing them with
em
is not appropriate. Instead, they should
be indicated with a
span
and a
class
, like so:
<p><span class='wordasword'>May</span> can be very ambiguous
in English, meaning might, can, or allowed, depending on
context.</p>
Then, add a CSS rule to the stylesheet to format this as italic:
span.wordasword { font-style: italic; }
Tidy, however, is not smart enough to figure this out and will need your help. Still, Tidy is a good first step.
Search WWH ::
Custom Search