My HTML is as follows:
What you really want is the CSS3 white-space-collapse: discard. But I'm not sure if any browsers actually support that property.
A couple alternative solutions is to let the tailing end of a tag consume the whitespace. For example:
Another thing I've seen done is to use HTML comments to consume whitespace
See thismat's solution if you are okay using floats, and depending on the requirements you might need to add a trailing that is set to clear: both;.
But the CSS3 property is probably the best theoretical way.