Java Reference
In-Depth Information
Consider using traditional HTML to display the message, “This is a note”, in a red font
and bold type. The following HTML would have to be used:
<font color="red"><p><b>This is a note</b></p></font>
There is quite a bit of “overhead” HTML here that has nothing to do with the text that is
being displayed. Each place that you want to use this style of text you would need to include
the additional “overhead” HTML that specifies the formatting properties for the text.
With CSS, you can define styles. Styles are either included in a separate style file, or
defined between a beginning <style> and ending </style> tag. Using CSS to format
the text above, you would simply include the following style:
.note {
color: red;
font-weight: bold;
}
Now, anytime you want to apply this style, you simply use a class attribute, such as:
<p class="note">This is a note</p>
This is very advantageous for bots. The above HTML example is far easier to parse than
the preceding traditional HTML example.
XHTML is often used in place of HTML in AJAX applications. XHTML looks almost iden-
tical to HTML with the main difference being that XHTML must follow XML formatting rules.
For example, the following example is fine under HTML, but is unacceptable in XHTML:
Line 1<br>
Line 2<br>
<ul>
<li>Option 1
<li>Option 2
<li>Option 3
</ul>
There are several missing end tags. The above document, recreated as XHTML would
look like this:
Line 1<br/>
Line 2<br/>
<ul>
<li>Option 1</li>
<li>Option 2</li>
<li>Option 3</li>
</ul>
The advantage is that this method makes it much easier for a parser, such as the DOM,
to understand the document.
Search WWH ::




Custom Search