tags:

views:

44

answers:

2

I know that in HTML4.0

<p>

tag is not a block-level element. What about in XHTML 1.0?

Thank you

This is the reference for HTML4.0 http://www.w3.org/TR/html401/struct/text.html

The P element represents a paragraph. It cannot contain block-level elements (including P itself).

Was that my misinterpretation?

+3  A: 

As far as I know, p is a block-level element going back to at least HTML 3.2.

Most elements that can appear in the document body fall into one of two groups: block level elements which cause paragraph breaks, and text level elements which don't. Common block level elements include H1 to H6 (headers), P (paragraphs) LI (list items), and HR (horizontal rules). Common text level elements include EM, I, B and FONT (character emphasis), A (hypertext links), IMG and APPLET (embedded objects) and BR (line breaks). Note that block elements generally act as containers for text level and other block level elements (excluding headings and address elements), while text level elements can only contain other text level elements. The exact model depends on the element.

http://www.w3.org/TR/REC-html32

And XHTML 1.0 is really the same exact thing as HTML 4.01 except less lenient. Meaning the elements serve the same purpose, are the same "level" ( block, inline, table ), just these rules apply:

  • all elements and attribute names must appear in lower case
  • all attribute values must be quoted
  • non-Empty Elements require a closing tag
  • empty elements are terminated using a space and a trailing slash
  • no attribute minimization is allowed
  • in strict XHTML, all inline elements must be contained in a block element

EDIT:

The P element represents a paragraph. It cannot contain block-level elements (including P itself).

This just means that the p cannot own other block level elements inside, meaning because it is block-level it cannot contain itself.

meder
I have this from w3c. I edited my post. Thank you
JohnWong
so is the p tag a special block-level element, since a block-level element is often the one that can contains itself, and other elements (both block-level and inline)?
JohnWong
Every element is unique, there are certain rules for certain elements, but yes you can consider it "special" since every element is special in its own way.
meder
+1  A: 

The P element represents a paragraph. It cannot contain block-level elements (including P itself).

This means that the P element is a block level element, and that it cannot contain other block level elements (such as DIV). Since P is itself a block level element, you cannot put a P inside another P.

Greg Hewgill
so is the p tag a special block-level element, since a block-level element is often the one that can contains itself, and other elements (both block-level and inline)? thank you.
JohnWong