To paraphrase this excellent explanation to a similar question on Stack Overflow -

Empty paragraphs are "padded" with a non-breaking space character so as to maintain their structure, as HTML elements that contain only whitespace are considered empty, and therefore have no height.

Empty h1,h2,h3,h4,h5,h6,th,td,pre,div,address and caption elements are also padded in this way.