HTML and CSS Reference
Usually this happens only to the first paragraph in a section. However, if the runs of paragraphs are interrupted
by a div , table , blockquote , or other element, there is likely such a block after each such block-level element.
Consequently, after running TagSoup over a page, search for empty paragraphs. Anytime you find one, it means
there's probably a paragraph-less block of text earlier in the document that you should enclose in a new p
element. However, this is tricky because often the start-tag and end-tag are on different lines. The following
regular expression will find most occurrences:
This expression will find any empty paragraphs that have attributes:
However, such paragraphs weren't created by Tidy or TagSoup, so you'll probably want to leave them in.