This is just a general rambling about the things I figured out about XHTML while spending a Sunday evening converting this site. Nothing will be earthshattering, and if you know anything about XHTML you probably already know this stuff.
It didn't seem intuitive to me at all, having developed web sites using plain old HTML for the last 5 years, that you would not be able to nest certain elements inside of other elements. In regular HTML, it would pretty much let you nest any type of tag within any other. This was useful when for some things like form tags. If you never noticed before, in some situations the closing element of a form tag likes to throw in an extra line break for you. Sometimes this isn't an issue, but when you are trying to stick a form in a small area, where a line break will screw with the layout, this becomes a problem. Normally I would just nest the form tag in some other kind of container, and this would usually solve the problem. Can you nest a form tag in other tags in XHTML? It appears the answer is sometimes. The W3C XHTML validator doesn't seem to mind if you nest a form in a div tag, but inside a paragraph or certain other tags and it freaks out.
There are several other examples of this, such as horizontal rules inside almost any other tag (which to be fair was a no-no in HTML, but almost every brower let you get away with it), and it seems counter intuitive to me. I understand the need for some rules of this nature, to handle tables and lists for example, but having rules about nesting forms in other non-form tags seems an afully lot like nit-picking.
There are only three quirks that I found with CSS and the DOM: multiple tags with the same id, span tags with a name attribute, and positioning, padding, and font sizes without a unit specified.
I imagine the HTML specs say you can't have two elements with the same id, but I find myself doing it quite a bit when I really should be using a class. I haven't found a recent browser that complains about this, but the validator sure doesn't like it. This is my fault for sure, but I just thought I would share.
Not many people use span tags, and I think they may be depreciated in XHTML, but I like them. They are handy for use as an auto-sizing container that doesn't need to be over-ridden with CSS clear and width properties to make them fit in a page layout. Laziness is a good excuse to like an element isn't it? Well, the validator doesn't care if they are in the page, but it doesn't like it if you have a name attribute on the tag. I don't really understand why, as other elements are allowed to have name attributes, but removing it fixed the error.
The last issue is really pretty minor, but could cause a lot of work in converting a site over to XHTML if you are lazy like me. In my style sheets I often don't specify a unit of measure when I set a padding or positioning property, unless I am using something other than pixels like em's or points. Let me tell you, when I converted my site over it didn't look pretty. Make sure you specify your units of measure in your style sheets. Enough said about that.
If you have tried to set up an XHTML page on a server using PHP as a scripting language, you may have run into a parser error telling you there is something wrong with the XML language declaration tag. Then again you may not have. The tag is optional if you are using UTF-8 encoding on your page, but that is supposed to change in later specifications of XHTML. The problem is the tag begins with "<?", which is a short PHP script opening tag. The fix is to turn off the short opening tag in the httpd.conf configuration file for apache by adding this line:
php_value "short_open_tag" "0"
This isn't a very big deal, but it took a little searching to figure out how to turn the tag off. I wasn't about to go through my entire site and and make PHP echo the tag out, which would probably have been the solution if I had ever used the short tag.
Overall, converting my site to XHTML was fairly painless. Google can tell you how to fix pretty much any problem you might run into, but it takes some time and effort to get everything converted and validated.