Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are new HTML5 elements like <section> and <article> pointless? [closed]

Tags:

html

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?

like image 366
dustinliamc Avatar asked Sep 29 '10 13:09

dustinliamc


People also ask

Is the article element new to HTML5?

The <article> tag is one of the new semantic elements introduced with HTML5. According to the HTML5 specification : The article element represents a section of content that forms an independent part of a document or site; for example, a magazine or newspaper article, or a blog entry.

Which element is obsolete in HTML5?

Some attributes from HTML4 are no longer allowed in HTML5 at all and they have been removed completely. img and iframe. caption, iframe, img, input, object, legend, table, hr, div, h1, h2, h3, h4, h5, h6, p, col, colgroup, tbody, td, tfoot, th, thead and tr. table, tr, td, th and body.


4 Answers

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.

like image 138
Joel Coehoorn Avatar answered Oct 18 '22 08:10

Joel Coehoorn


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.

like image 21
keyboardP Avatar answered Oct 18 '22 08:10

keyboardP


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.

like image 37
Michael Avatar answered Oct 18 '22 10:10

Michael


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

like image 38
graham Avatar answered Oct 18 '22 08:10

graham