You'd think WordPress would take your HTML as given when you paste it into the text editor (not visual editor) of a page or post. But no, when you view your page WordPress has decided to add lots of <br>
and <p>
elements wherever it feel like.
Prevent this by installing this tiny plugin to disable automatic layout breaking: https://wordpress.org/plugins/dont-muck-my-markup/
UPDATE 2018: Rather write your posts in Markdown using Wordpress built in support for Markdown.