47

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?

4
  • 3
    +1 It's a good question. Some people really just don't know. Commented Sep 30, 2010 at 14:32
  • 1
    Related: en.wikipedia.org/wiki/Semantic_web Commented Oct 2, 2010 at 23:01
  • the only site I found using them is getbootstrap.com Commented Apr 3, 2014 at 19:00
  • a good sum on the topic: impressivewebs.com/html5-section Commented Dec 14, 2017 at 17:25

8 Answers 8

26

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Also, they are very critical for bots (aka search engines) like google, Yahoo etc who crawl the web pages. Use of semantic elements helps them index a more fine-tune content for the end-user who is searching some content.
13

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.

Comments

5

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.

7 Comments

This is totally unrelated to the question or your answer, but... many CSS authors would advise against using id selectors. Perhaps you might want to change your examples so that they have class selectors instead. I am not judging the meaning of your answer, I am merely suggesting another way to present it.
@TestSubject528491 writing the example I didn't think of the example as CSS but a kind of pseudo HTML, but you are right this might lead people to think this is a good way to do CSS. The actual CSS would not have the section in front of section, but only #content which is perfectly fine and fast.
@chharvey That's ridiculous. A lot of people never use IDs and only use classes, which is absurd. IDs exist for thos elements the only occur once on a page and which can be targeted as such. What would you assume is the downside of using IDs?
@chharvey Thank you for those articles, food for thought. I do not agree with the author though. Yes, they are highly specific, that's the beauty of it. Also, when the IDs are already available for usage in for instance JS functions, it seems silly to add another class to that element. I think that IDs should be refrained from when working on very large scale projects as to prevent re-using IDs. In smaller projects I see no problem.
|
3

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; } 

6 Comments

“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, 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.
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, that was just an opinion in the first paragraph there reflecting the context of the original question. I wouldn't think continuing the discussion around HTML5 would not be useful - that response was from a Q & A session after a talk at @media in London earlier this year following a question about why these specific tags were chosen. If you read my answer fully you'll see that I did point out what web developers have to gain by using HTML5 tags
“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.
That's understandable, I've edited the first paragraph of my answer to remove any potentially misleading statements.
|
2

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.

Comments

2

I think the great failing of HTML semantic divisions such as is that the code to make these work in the real world involves multiple statements to cope with the actual browsers that are in use by real people. The examples given above aren't real and, in any case, to read the html5 code you have to recall that a footer is a kind of div. Just calling it a div and giving it a descriptive ID seems to me to be far clearer, even if we forget about the multiple statements that you'll actually need (really, you will. For several years). Here's an idea. Make the semantic div IDs attributes, like 'title=' and so on - let the modern browsers and screen readers use this info to identify sections, asides and so on and the code will be cleaner. Don't stop calling a div a div, because you can't install new browsers for the whole planet.

<div id ="footer" class="someclass someotherclass" semantic="footer">You, the screen readers and all browsers know this is a div</div> 

Comments

1

Allowing heading scope is the main benefit of <section> and <article>. See http://diveintohtml5.info/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.

Comments

0

The visual benefit of using the new HTML5 markup tags might be hidden from users but users may unwittingly benefit because these tags may have provided them with a better search result. I think once HTML5 becomes a standard the usage of these markup tags will become extremely important for your sites SEO.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.