Thursday, August 05, 2004

Signatures on root i.e. <html id="">

They would be a good idea. You do need a tag at this level to apply different styles to the whole viewport if you're using XHTML served properly as application/xhtml+xml from the one style-sheet, and it's a useful way to identify your site for site-based user defined styles. It just isn't valid in XHTML 1.1 - unless you make the legitimate change as per Anne vanKesteren and extend the DTD thus



at which point a page containing

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" id="www-stevegilham-com-grey">

will validate against (at least) my Java based validator using Xerces, and even against the w3c validator!

Alas, in both Firefox 0.9.2 and IE6 (so probably all browsers) it shows up the characters " ] >" at the start of the page - a premature closing of the DOCTYPE - when presented as text/html. It is clean when presented as application/xhtml+xml to Firefox. This makes it more awkward for static pages served from somewhere you don't control. In Firefox, adding margin-top: -1.2em; to the body element pushes it out of the way, but not in IE - there you need to put a non-semantic div inside the body to hold everything it does, and move and style that instead (but only for IE). And you don't want to do either for proper XHTML. *sigh*

The stray characters are affected by some *-level styles (font-size, line-height, display), but those usually nuke the page - and body level styles don't override that.

Post a Comment