[UPHPU] Validation
Tyler Gee
geekout at gmail.com
Tue Jun 6 17:43:25 MDT 2006
> A good example:
> ...
> <div id="header">
> <h1>Page Title</h1>
> <ul>
> <li>
> <a href="/">Home</a>
> </li>
> <li>
> <a href="/company.html">Company</a>
> </li>
> <li>
> <a href="/products.html">Products</a>
> </li>
> </ul>
> </div>
> Jon
A better example...
<div id="header_area">
<h1 id="page_title">Page Title</h1>
<ul id="main_menu">
<li>
<a href="/">Home</a>
</li>
<li>
<a href="/company.html">Company</a>
</li>
<li>
<a href="/products.html">Products</a>
</li>
</ul>
</div>
Perhaps I shouldn't have said you need ID and CLASS attributes on
*everything* because you are right, you certainly don't. And I also
agree with all the comments about re-writing the tags, there is
definitly no point. But your good example is not really a good
example. You should use the ID tags to markup the logical structure
of the document. What happens when you want to access your list via
the DOM? In the example you give it would just be hard and annoying
whereas if you have an ID attribute you can just write:
var main_menu = document.getElementById('main_menu');
Or, better yet if you are using prototype.js
var main_menu = $('main_menu');
And so on and so forth. Certainly I don't want to come across as a
purist, although I have those tendencies, but I do think it makes
sense to separate your content and appearance and then logically
markup your document with identifiers. The whole point of XHTML is to
be more XML like and what would be the point of XML if you could not
define your own tags...it would be HTML. And hopefully no one will go
down the route of arguing that XML is worthless.
Cheers for now,
--
~Tyler
More information about the UPHPU
mailing list