Thanks for the reply. You're quite right and I've found the source of my confusion. It looks like when you use the "inspect element" tool in Google Chrome, it automatically closes off tags if they're not already done so. If I look in source, things are how they should be.
Now if only I can figure out how to stop xpages adding extra divs when I use custom controls or xp:include.