Viken Karaguesian wrote:[color=blue]
> I have a question about the XHTML doctype. I often times see this statement
> included in the <html> tag:
>
> <html xmlns="http://www.w3.org/1999/xhtml">
>
> If I use the full standard XHTML doctype, do I need to add the extra html
> statement or is just plain ol' <html> enough?[/color]
Although the W3C validator will not issue an error or even a warning if
you omit it simply because of the way it's declared in the DTD, it is
actually required for practical reasons. But for it to have any effect
whatsoever, the page needs to be viewed under XML conditions, by using
an XML MIME type. Do a search for XML MIME Types, application/xhtml+xml
and XML Namespaces for more information about using XHTML correctly.
As an experiment, to see the effect for yourself, make a small XHTML
document, give the file a .xhtml or .xml file extension and load the
file from your local file system in a browser like Firefox. (On most
systems, these file extensions are commonly associated with the XML MIME
types: application/xhtml+xml and application/xml, respectively. But
beyond this, file extensions are essentially meaningless in the context
of the web)
When the above xmlns attribute is included, your browser should know
that the elements belong to the XHTML namespace and render them
appropriately. Without it, the browser won't recognise the elements as
XHTML elements and, in the case of Firefox and some other browsers, will
render a pretty-printed XML tree.
Theoretically, with a validating XML parser, the xmlns attribute
wouldn't be necessary, but most browsers (except for IE) don't use a
validating XML parser anyway; and certainly no browser I know of that
actually supports XHTML uses one.
--
Lachlan Hunt
http://lachy.id.au/ http://GetFirefox.com/ Rediscover the Web
http://GetThunderbird.com/ Reclaim your Inbox