tags:

views:

199

answers:

6

Don't kill me just yet, I'm asking out of pure curiosity.

Elements like <section>, <nav>, <article>, <aside> etc all seem completely pointless. Sure they make everything have its own little place (and seo'd)... But it IS possible to over-organize things. There are some cases where things don't fit in any of the categories too. It also increases time spent trying to code these things... I just don't see any real purpose for moving to add these new elements. What do we (developers and people who view the webpages alike) have to gain from adding them?

+8  A: 

These elements are important for things like screen readers for the blind and eBook readers like Kindle. It helps them know what to show/read and when.

Joel Coehoorn
+3  A: 

Have read of this article, as it points out various advantages such as:

There are several advantages to using these elements. When used in conjunction with the heading elements (h1 to h6), all of these provide a way to mark up nested sections with heading levels, beyond the six levels possible with previous versions of HTML.

and

By identifying the purpose of sections in the page using specific sectioning elements, assistive technology can help the user to more easily navigate the page. For example, they can easily skip over the navigation section or quickly jump from one article to the next without the need for authors to provide skip links. Authors also benefit because replacing many of the divs in the document with one of several distinct elements can help make the source code clearer and easier to author.

keyboardP
+2  A: 

HTML5 styled CSS is also somewhat easier to read:

div#header
div#content .article
div#content .article h1
div#content .article h1+h2
div#footer

vs

header
section#content
section#content article
section#content article hgroup h1
section#content article hgroup h2
footer

(not using advanced selector)

And as keyboardP hinted through the quote it is easier to navigate a page for non human vistors. It adds semantics. But I do agree with you, that sometimes it can be hard to figure out which element to use section, article or good old div. IMO, this makes the semantic less strong. But lets see what happens.

Michael
A: 

It's all about semantics!

But I agree with you that to some people these new may tags seem pointless. A frequently asked question is why these particular tags and not any others were chosen, especially as some of the tags are very blog specific (article, section etc) but didn't include other commonly used names, such as product or content. As you can see in the comments below, it's a hotly debated topic!

So for using these new tags it really depends on how you write your markup, and there is no right or wrong way for how go about it. Take lists for example, you may use them for your navigation and not want them styled and also use them in your main content and need them styled. You could either add extra classes to specify which lists are styled or you could use your markup and target styles from the tags alone:

<nav>
 <ul>
  <li><a href="">Nav item 1</a></li>
  <li><a href="">Nav item 2</a></li>
 </ul>
</nav>
<div>
 <ul>
  <li><a href="">List item 1</a><li>
  <li><a href="">List item 1</a></li>
 <ul>
</div>

and in your CSS:


ul { list-style: bullet }
nav ul { list-style: none; }

graham
“If you ask anyone who was part of the working group why these particular tags and not any others were chosen they can't really answer”. Right. Except if you ask Ian Hickson, as xhtml.com did in [this interview](http://xhtml.com/en/future/conversation-with-x-html-5-team/), where he replied that the new elements were based on what authors were already doing, which was judged via [a survey of several billion web pages done by Google](http://code.google.com/webstats/2005-12/classes.html).
Paul D. Waite
You’ll notice for example that 1. `nav` was the 8th most commonly-used class, 2. `navigation` wasn’t in the top 20, and 3. `nav` takes up fewer bytes of bandwidth than `navigation`.
Paul D. Waite
graham
“that was just an opinion in the first paragraph there reflecting the context of the original question” — You mean my quote from you? It doesn’t really read as an opinion, it reads like you’re stating that there wasn’t any reason why the tags mentioned were added to HTML5 instead of others. And that’s incorrect. That’s the only bit of your answer I object to.
Paul D. Waite
That's understandable, I've edited the first paragraph of my answer to remove any potentially misleading statements.
graham
Top stuff, downvote rescinded.
Paul D. Waite
A: 

Allowing heading scope is the main benefit. See http://diveintohtml5.org/semantics.html#header-element.

Briefly: in HTML5, it’s much easier to mark up an outline of your document (which is useful for screen readers) without worrying about whether to use <h2> or <h3> or whatever (which gets really complicated when you include components in different places on different pages).

They couldn’t have done that with <div>s, because there are billions of web pages that have used <div>s and headings already, without necessarily intending heading scope.

Admittedly, <section> and <hgroup> would have been sufficient for this purpose.

Paul D. Waite
A: 

ok, which one sounds more productive and easy to read:

 <div id="nav">list of links</div>
 <div id=header> 
 <div id=section>content is good
 </div>
 </div>
 <div id=footer>copyright</div>

vs

  <nav>list of links</nav>
  <header>
  <section>content is good</section>
  </header> 
   <footer>copyright</footer>

It would be so much easier to scan for section and header and dialog in the midst of DIV junkyard. It also improves accessibility for the blind since would clearly tell the screenreader what it is. Same with article tag. Additionally, it improves structure and provide more meaning to the tags.

Some web browsers don't support CSS styling on unknown elements and to me, that's incredibly shortsighted.

netrox