Saturday, 19 March 2005

Cleaning Up

This site used to be nearly valid HTML but not quite so I decided to clean it up. It took about an hour or so to get it to validate against the XHTML 1.0 Transitional DTD. Most of the work was around the automatically generated blogrolls in the side bar. The way it used to work looked something like this:

<div>
  <ul>
    <script...></script>
  </ul>
</div>

With the <script> tag calling BlogRolling to generate a list of links enclosed in <li> tags. The problem with this is that, according to the specification, <script> cannot be enclosed in <ul>. To correct this, I had to first correct the BlogRolling configuration so that it enclosed the whole list into a top level tag. Unfortunately, BlogRolling only supports <div> and <table> as global enclosing tags. I choose <div> and enclosed each individual link into its own <p> tag. By doing this, I lost the semantic of a list in the resulting HTML but I could have some code that looked like this:

<div>
  <script...></script>
</div>

Now, this validates fine and the result is visually very similar so by tweaking the CSS, I got something I liked.

Once having achieved compliance with the Transitional DTD, I had only 2 errors against the Strict DTD so I decided to go all the way and make the site validate against the XHTML 1.0 Strict DTD. And of course, I added the logo at the bottom.

I then dealt with the CSS code. The part I have control over was easy: there was 1 error that was easily corrected. However, the CSS provided by Blogger to style the toolbar on top doesn't validate so all in all the CSS on this site is not valid. This is a shame really because the errors reported by the validator look like they could be solved reasonably easily. At least everything I have control over validates, which was the aim of the exercise.

Post a Comment