I had a question when I came across the HTML 4.01 DTD: In the strict DTD, a <p>
element is defined as <!ELEMENT P - O (%inline;)* -- paragraph -->
but I thought that <p>
was a block-level element, and all (maybe almost all) user agents define <p>
as a block-level.
So is <p>
a block-level or inline-level element?
Paragraphs are block-level elements, which means that they block off a whole line for themselves, and images are inline elements, which means they will automatically be placed next to one another on the same line. Block-level elements that you've seen so far include: Headings. Paragraphs (p)
Block-level Elements Two commonly used block elements are: <p> and <div> . The <p> element defines a paragraph in an HTML document. The <div> element defines a division or a section in an HTML document. The <p> element is a block-level element.
They are block elements.
By default, inline elements do not force a new line to begin in the document flow. Block elements, on the other hand, typically cause a line break to occur (although, as usual, this can be changed using CSS).
It is a block level element. What that DTD is saying is that <p>
tags can only contain inline elements.
Of course it is.
The following are defined as block-level elements in XHTML 1.0:
* address - Address * blockquote - Block quotation * center - Centered block * dir - Directory list * div - Generic block-level container * dl - Definition list * fieldset - Form control group * form - Interactive form * h1 - Level-one heading * h2 - Level-two heading * h3 - Level-three heading * h4 - Level-four heading * h5 - Level-five heading * h6 - Level-six heading * hr - Horizontal rule * isindex - Input prompt * menu - Menu list * noframes - Frames alternate content * noscript - Alternate script content * ol - Ordered list * p - Paragraph * pre - Preformatted text * table - Table * ul - Unordered list
The following elements may also be considered block-level elements since they may contain block-level elements:
* dd - Definition description * dt - Definition term * frameset - Frameset * li - List item * tbody - Table body * td - Table data cell * tfoot - Table foot * th - Table header cell * thead - Table head * tr - Table row
The following elements may be used as either block-level elements or inline elements. If used as inline elements (e.g., within another inline element or a p), these elements should not contain any block-level elements.
* applet - Java applet * button - Button * del - Deleted text * iframe - Inline frame * ins - Inserted text * map - Image map * object - Object * script - Client-side script
More Info Here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With