View Single Post
08-12-2004, 01:14 AM
#10
Salathe is offline Salathe
Salathe's Avatar
Status: Community Archaeologist
Join date: Jul 2004
Location: Scotland
Expertise: Software Development
Software: vim, PHP
 
Posts: 3,820
iTrader: 25 / 100%
 

Salathe will become famous soon enough

Send a message via MSN to Salathe

  Old

The whole idea of creating a bunch of standards is/was in order to allow browser creators (and web developers) to come together in working with the code. With a set of standards to follow, we know how a browser should act with a certain piece of (lets say) HTML or CSS. We know that a <strong> tag will (generally) display emboldened text - there is nothing forcing browsers to interpret the tag this way; there is nothing forcing the browser to even recognise this tag. It is simply following the standards.

So, ideally and in a perfect world, standards mean that a single set of (validated) lines of code should and would display identically in any browser. Unfortunately, few browsers actually follow the various standards to the letter (*coughIEcough*) but this is happening, just give it time.

Now, my single most favourite advantage of using XHTML over HTML 4.0 (or my own random version of HTML) is that of machine-readability. If the document is well-formed XML there is nothing stopping another computer/website/script from reading my document and understanding it as intended. A script knows how to read the 'title' element of a certain page because the standards say that it should be in the position 'html->head->title' and there should only be one of them. Obviously that is just a simple example but allowing your HTML to be proper XHTML really does open up the doors to machine-readability. I've mentioned machine-readability (whoa, will he ever shut up about it) but well-formed XHTML can also be much much more human-readable! You know how hard it is to debug a table-based layout with nested tables, divs, spans, images and a million-and-one attributes... well structured XHTML is much, much clearer to understand.

A particular annoyance of mine at the moment is that people are so very hung up on the notion of validation. Yes, that is one part of the process which should not be overlooked but what is the point of valid code if it does not work? For example, it is perfectly valid to have the following:
HTML Code:
...
<div id="menu">
  <a href="mylink.html">Link</a><br />
  <a href="mylink.php?id=other&amp;style=yeah_right">Other Link</a>
</div>
...
but doesn't it just make so much more sense to use a HTML list - after all, it is a list of hyperlinks! (ignore the href's just an example of future-proofing.)
HTML Code:
...
<ul id="menu">
  <li><a href="/link" title="Demo page of Link software.">Link</a></li>
  <li><a href="/otherlink" title="Information on the OtherLink">Other Link</a></li>
</ul>
...
I'll be quiet now.

- Salathe