|
Every page must have exactly one root element
The root element of a web page is the HTML
element, and there can be only one root element per
document.
Thus the basic form of an XHTML valid page is:
<!DOCTYPE...
<html>
<head>
<title>...</title>
</head>
<body>
</body>
</html>
All elements must be in lower case
This is the major visual difference between HTML and
XHTML. Upper case tag names are strictly forbidden. Thus
where you used to say:
<HTML>
You would now say
<html>
The same goes for all XHTML elements EXCEPT the DTD.
All elements must be properly nested
Simply put, this means that elements must be closed in
the order opposite to which they were opened. In this
instance,
<ol>
<li><span>...</li><span>
</ol>
is incorrect while:
<ol>
<li><span>...</span></li>
</ol>
is correct. Simply remember to close tags as you open
them and all should be well. Once you get used to doing this
it actually makes sense, and more than that, it just looks
wrong if you mess it up! All elements must be closed
This is important to look at closely.
The idea is that EVERY TAG must be closed, even tags that
close themselves, like the <br> and
<img> tags. A few tags that are self
explanitory are shown below:
<div>...</div>
<form>...</form>
<li>...</li>
<ol>...</ol>
<a href=''>...</a>
XHTML: What you need to know
XHTML: What you need to know
What to do with the self closing tags?
|