Re: DIV as an inline container

On 04/08/07, Robert Burns <rob@robburns.com> wrote:
> I don't see any problem with DIV with a strictly inline-level or
> inline-level content. Right now the draft says:
>
> "followed by either zero or more block-level elements, or inline-
> level content (but not both)."
>
> So what's wrong with inline level content? Historically,, DIV has
> either been used as either 1) a sectioning element (block-level /
> structural only); or 2) as a more flexible P element (structural
> inline-level or strictly inline-level). With our current draft, I
> think the sectioning elements practically remove any need for DIV in
> the first role. SECTION seems generic enough for any way DIV might
> have been used as a generic in that way. That only leaves DIV as an
> inline container (structural or strict). In some ways DIV could just
> serve the content model need of P for the text/html serialization.
> The semantic space left for DIV is really not any broader than that
> for P (in the XML serialization). We could even add a minimized
> boolean to DIV to declare this paragraph usage, for example:
>
>   <div p>My structural inline-level paragraph content</div>.

Well, first of all that would make many valid HTML4 documents invalid
HTML5 documents.

Second, the way I understood the intent of adding the section element
is that section is a content grouping mechanism primarily for giving
related text an explicit grouping instead of as is the case with the
h# elements in HTML4*. The div element on the other hand is also a
content grouping mechanism but it doesn't have any explicit grouping
purpose, textual or otherwise. The grouping purpose is given to it by
it's usage - such as class or id attributes for styling or scripting,
attaching events to it, or simply the effects on the DOM tree from the
div being there, etc.

*  After you've used a heading, you cannot make a paragraph not belong
under that heading in the outline mechanism for HTML4 without giving
it another heading of equivalent rank or better. You can do that if
you wrap headings and paragraphs with section elements in HTML5.
-- 
David "liorean" Andersson

Received on Saturday, 4 August 2007 09:53:21 UTC