Precise Meaning of the <p> tag
Last edited by keyboard1333; 07-05-2012 at 10:59 PM.
Reason: Removed post
The p tag (which stands for paragraph) opens a block level element similar to a div tag. There are two major differences:
- It cannot contain another block level element. This means that if there's a div, blockquote, table, etc., or even just another p inside it, it closes automatically at the beginning of that other block level element. This is regardless of where you might place the </p> tag. It is the only block level element that behaves this way.
- Unlike div which by default in all browsers has no margin, many if not all browsers give the p element default top and bottom margins. And these vary by browser.
This standard seems to be being softened in HTML 5, perhaps allowing nested block level elements other than lists, but the wording is vague:
Individual browsers might vary. But I suspect most if not all still adhere to the "cannot contain block-level elements (including P itself)" rule.
Last edited by jscheuer1; 07-05-2012 at 01:56 PM.
Reason: see also, etc.
Tags for this Thread