Blog |Follow Nick on Twitter| About
 

As part of my blogging re-vamp and a continuation of making sure my site was standards compliant I've had to go through the pain of converting my old HTML to new xhtml.

Why did this happen ? Well to be honest I made a bit of a mistake, I've had some training on HTML, and have a book too ;-) , so obviously that's what I started to code my site in, then I introduced wordpress, and unwittingly started to code my theme in HTML, only to find out that all the work I'd done was wrong because wordpress uses xhtml :-(

So what have I learned ? How painful was it ? Well that really depends on your original html, you see my old HTML was mostly in lower case (because I'm lazy) this is contrary to some teaching materials, so if you were really good at using uppercase tags, then migrating to xhtml could be very painful for you.

Basic lessons that got me by were:

  • All code in xhtml MUST be in lower case, this even includes \<form action="POST" > statements, rather it should be \<form action="post" > :-)
  • Short codes cannot be used, i.e. align=center or border=0 isn't valid anymore, they must be align="center" and border="0"
  • Tags must be properly nested, so you can't do \<a>\<i>something\</a>\</i> it must be \<a>\<i>something\</i>\</a>
  • All tags must be closed, i.e. \</p> is now mandatory, and \<br> should look like \<br /> in fact the same goes for \<img> and \<input> tags too !
  • Some Tags don't mix; I've found that you can't open a new \<div> without closing a \<p> first.
  • And the most important lesson was use http://validator.w3.org/ if you can't work out what the problem is, googling and changing the tag you're using worked for me.

 

 
Nick Bettison ©