-
Precise Meaning of the <p> tag
Last edited by keyboard; 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.
See also:
http://www.dynamicdrive.com/forums/s...ad.php?t=40199
and:
http://www.w3.org/TR/html401/struct/text.html#edef-P
This standard seems to be being softened in HTML 5, perhaps allowing nested block level elements other than lists, but the wording is vague:
http://www.w3.org/TR/html5/content-m...html#paragraph
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks