Skip navigation

Monthly Archives: April 2012

I’ve been a member of the W3C html working group for a couple of years now. I don’t really participate as much as I would like, but I still think the group’s work is important.

So, with that in mind, I figured it was time to finally convert my website to html5. While technically it is still just a draft proposal, the fairly basic features are set, so a simple site like mine should be easy to convert.  I figured it might be worth putting what I did up here, even if just so I can see it later.

Up until now, I’ve always used XHTML. This means I kept presentational elements to a minimum and didn’t have the mess of tag soup that many older html documents contain.

The first thing was to change the mime-type the page is served as. xhtml has to be served with the application/xml+xhtml type to be valid (even though the broken IE browser can’t handle that). The correct type for html5 is simple text/html This can be done in your .htaccess file with the line:

RewriteRule \.html$ – [T=text/html]

Then, I replaced the top of each file (up to the title tag) with:

< !doctype html>

Other than that, I only had a few minor issues to fix.  I used the tag in one place (replaced it with css font-size:300%;), put the align properties for the tables in css

table     {
    margin-left:auto;
    margin-right:auto;
    text-align: center;
    width:100%;
    }

And finally since the name element is deprecated, any time I used it, I just replaced it with an id in a nearby tag (usually a heading tag, but sometimes a paragraph).

I haven’t yet dealt with this blog (but due to blogger’s messy templates, I never even got it to be valid xhtml, so this may not be easy). I also have a bunch of pages that are generated by a perl script. I modified the perl script, but just don’t feel like testing it tonight. But otherwise, goodbye XHTML, it was fun.  All told, the html5 pages are definitely smaller since there is less junk on the top of each page and I can’t be lazy and put styling all over the place, it has to go in the css.