tag is a block-level element in XHTML?

前端 未结 2 603
小鲜肉
小鲜肉 2021-01-21 00:00

I know that in HTML4.0

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

Thank you

This is the reference f

2条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-21 00:35

    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.

提交回复
热议问题