[whatwg] The div element
Tab Atkins Jr.
jackalmage at gmail.com
Wed Feb 27 17:58:02 PST 2008
On Wed, Feb 27, 2008 at 7:38 PM, Geoff Pack <pack.geoff at abc.net.au> wrote:
>
> Why does the HTML5 spec say "The div element represents nothing at all" ?
> [http://www.whatwg.org/specs/web-apps/current-work/#the-div]
>
> Div clearly stands for 'division', as was specified in the HTML 3.2 spec:
> "DIV elements can be used to structure HTML documents as a hierarchy of
> divisions." [http://www.w3.org/TR/REC-html32#div]
>
> So what gives - why is everyone so keen to claim that 'div' is
> meaningless?
> And why so keen on 'section', which is pretty much synonymous in this
> context.
>
> Cheers,
>
That definition you quote gives the answer. ^_^ "A division" doesn't tell
you *anything* about what the content of the <div> means, or what place it
holds within the greater structure of the document. It's merely a
'division'. The lack of any further definition has led to its use for
*anything* that needs grouping, leading to the term "div-mania". I used
<div>s all over the place when I first started coding, before I learned
proper practices (luckily, the only applications were internal and aren't
used anymore, so I didn't contribute to the poor state of the web ^_^).
Even if you can divine some actual semantics out of the 3.2 definition,
<div> has clearly lost all semantics in practice, which is what matters.
<section> doesn't have quite that problem. It's a generic grouping element,
true, but it is so in the same way that <p> is. It's designed to wrap
*content* that's thematically related, and the examples give relatively
clear usage guidelines. It may lose its semantics in practice, but we'll
have to wait to see that. I'm hopeful, for several reasons. One, <div>
already exists, and has spread to fill all niches naturally, leaving
<section> little incentive to spread similarly. ^_^ As well, <section>'s
name is more specific and gives its semantics more clearly. Finally, a lot
of the common places where <div> is currently used (and <section> could be
applied) are instead filled with new elements, restricting <section>'s
ability to get a foothold in generic-ness.
Anyway, we need a meaningless block-level element, the same as we need
<span> for in-line content. It lets us fill in the holes that the spec
fails to or refuses to cover, without muddying up the document's semantics.
~TJ Atkins
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20080227/00211cb5/attachment-0001.htm>
More information about the whatwg
mailing list