3.3.2. Sample Tags
Here are some tags with attributes:
<a outsideurl=/catalog.html">
<ul compact>
<ul compact="compact">
<input type=text name=filename size=24 maxlength=80>
<link title="Table of Contents">
The first example is the <a> tag for a
hyperlink to O'Reilly & Associates' World Wide
Web-based catalog of products. It has a single attribute,
href, followed by the catalog's address in
cyberspace -- its URL.
The second example shows an HTML tag that formats text into an
unordered list of items. Its single
attribute -- compact, which limits the space
between list items -- does not require a value.
The third example demonstrates how the second example must be written
in XHTML. Notice the compact attribute now has a
value, albeit redundant, and that its value is enclosed in double
quotes.
The fourth example shows an HTML tag with multiple attributes, each
with a value that does not require enclosing quotation marks. Of
course, with XHTML, each attribute value must be enclosed in double
quotes.
The last example shows proper use of enclosing quotation marks when
the attribute value is more than one word long.
What is not immediately evident in these examples is that while HTML
attribute names are not case-sensitive (href works
the same as HREF and HreF in
HTML), most attribute values are case-sensitive. The value
filename for the name attribute
in the <input> tag example is not the same
as the value Filename, for instance.