I have some HTML code. Here is a link to a fiddle with a snippet:
http://jsfiddle.net/U32UU/2/
The problem does not show up in jsfiddle, but you can copy the snippet locally and see it in your browser. With the doctype specification included, the issue is everything that has the “error” style tag is badly formatted. There is space added above and below that row. If I remove the doctype directive, then the problem goes away and the formatting looks good.
Looking here: http://www.w3schools.com/tags/ref_html_dtd.asp
I am not doing anything not supported by that doctype. I am also wondering if I even need the doctype specification. It seems to work just fine without it, but I would like to know why the formatting issue is there.
Paragraphs are supposed to have margins. In strict mode (with a DOCTYPE), they always do, but in quirks mode (without a DOCTYPE), the margins disappear when the paragraph is put inside a table. This is a error in the browser! (A deliberate one, by the way.)
So if you want a paragraph without margins, set its margin property to 0.
or if you want this to happen only inside tables,
This will work in both strict and quirks mode.