[whatwg] wrapper element

Jukka K. Korpela jkorpela at cs.tut.fi
Sun Feb 27 12:46:05 PST 2011


Bjartur Thorlacius wrote:
[quotation reorganized by me]

> On 2/27/11, usuario <soyhobo at gmail.com> wrote:
>
>> Tiis may seem somewhat silly, every front-end developer have ever
>> used a a wrapper div, shouldn't it be more semantic to have a
>> wrapper element?
>
> If said wrappers don't have any semantics but grouping loosely related
> elements, for which no semantic container exists, div seems
> appropriate.

I guess you mean a group that is not best describable as <nav> or <footer> 
or <section> or some of the other semantic elements. The most obvious 
candidate is the "content proper", as people often use, mainly for styling 
purposes, grouping together any content that is not a header, a navigation 
block, or a footer. In some cases, you might make it <article> or <section>, 
but if those don't apply naturally, it should be <div>. It is better to be 
semantically empty than to be semantically wrong, or even bordeline.

> What semantics would such an wrapper element provide over <div>? I'd
> rather discourage, and provide alternative features to wrapping.
> Providing another element for that purpose goes against that.

Thinking purely logically (if we dare), <wrapper> would have the benefit of 
explicitly saying "this is a wrapper for grouping, for no semantic reason", 
thereby distinguishing it from <div> which may, and often does, involve 
semantic or logical grouping. For example, <div id="footer"> is probably a 
footer of some kind, not arbitrary grouping.

But thinking pragmatically, it is difficult to see strong reasons to 
distinguishing wrappers from legacy use of <div>. Moreover, I don't think 
people would use <wrapper> much, since they can use <div> and are accustomed 
to <div>.

-- 
Yucca, http://www.cs.tut.fi/~jkorpela/ 




More information about the whatwg mailing list