HTML and CSS Reference
In-Depth Information
There are markup elements, called empty elements , which do not enclose any content, thus
need no close tags at all, or in the case of XHTML use a self-close identification scheme. For
example, to insert a line break, use a single <br> tag, which represents the empty br element,
because it doesn't enclose any content and thus has no corresponding close tag:
However, in XML markup variants, particularly XHTML, an unclosed tag is not allowed, so
you need to close the tag
or, more commonly, use a self-identification of closure like so:
<br />
The start tag of an element might contain attributes that modify the meaning of the tag.
For example, in HTML, the simple inclusion of the noshade attribute in an <hr> tag, as
shown here:
<hr noshade>
indicates that there should be no shading applied to this horizontal rule. Under XHTML,
such style attributes are not allowed, because all attributes must have a value, so instead
you have to use syntax like this:
<hr noshade="noshade" />
As the preceding example shows, attributes may require values, which are specified with an
equal sign; these values should be enclosed within double or single quotes. For example,
using standard HTML syntax,
<img src="dog.gif" alt="Angus-Black Scottish Terrier" height="100"
specifies four attributes for this <img> tag that are used to provide more information about
the use of the included image. Under traditional HTML, in the case of simple alphanumeric
attribute values, the use of quotes is optional, as shown here:
<p class=fancy>
Regardless of the flexibility provided under standard HTML, you should always aim to
use quotes on all attributes. You will find that doing so makes markup more consistent,
makes upgrading to stricter markup versions far easier, and tends to help reduce errors
caused by inconsistency.
Search WWH ::

Custom Search