Included within the new HTML5 specifications are a new base template, several revised elements, and in addition, the HTML5 specification provides new section and structural elements that you can start using today to streamline your markup coding practices.
Several elements overlap into both sectional and structural descriptions, including the article <article>, aside <aside>, and section <section> tags, and descriptions for proper usage of the headings group <hgroup> and <h1 – h6> headings.
Section elements have been added to the specification as a way of semantically representing content on the web. This is the specification’s cure for the rampant div-itis and class-itis that has plagued markup coding practices in recent years. Web authors are strongly encouraged to view the <div> element as an element of last resort. When no other element is suitable and all section element options have been exhausted then the <div> can be utilized. Use of the <div> element instead of more appropriate sectional elements leads to accessibility issues for readers and becomes a maintenance headache for authors. Semantic meaning may require adding an ID and this is recommended: i.e., <article id=”blog”>.
This element falls under the flow content and sectioning content categories of the specification. The <article> specification states that the article element can represent a self-contained composition in a document, page, application, or site that is independently reusable or available for distribution, e.g., in syndication. The article element would include the form of a blog post, a magazine or newspaper article, a comment, a widget or gadget, or any form of independent item of content. Nested article elements must be related in principal to the outer article element, for example, comments. An example below shows a blog post using the <article> element:
<h1>Bon Vivant Adventures</h1>
<p>Want to order water with your dinner in Paris? Be like the French, and
be sure you use the proper inflection when you ask for <i>carafe d'eau</i>.</p>
<a href="?comments=1">Show comments...</a>
This element usage has been reassessed since its initial specification as holding secondary content related to the site as a whole, such as the commonly known “sidebar.” Now the acceptable use for an <aside> element is for secondary content when not nested within an article element.
The new definition of use for an <aside> element means that when nested within an <article> element, the content should be specifically related to the content within the article element. And when the <aside> element is used outside of an <article> element the contents should be related to the site as a whole, e.g., navigation, blogroll, and relevant content to the page. An example below shows the use of the <aside> element within a blog post and the page:
<h2>The Next Blog Post</h2>
<p>This blog post is contained within the article element.</p>
<li><a href="#/fn1">Footnote#1</a> This aside pertains to the contents of this article</li>
This element represents an area within the web document page or application with a themed grouping of content. Several examples include chapters of a book, several tabbed pages within a tabbed dialog box, or numbered sections of a thesis. Other examples for the use of the <section> element would be within a web page document that is divided into sections for introductions, news items, blog posts, featured content, and contact information. The HTML5 specification on the <section> element does make note that web authors are encouraged to use the <article> element instead of the <section> element when it would be appropriate to syndicate the contents of the element. And as a general rule the <section> element is appropriate only if the contents would be listed explicitly within the document’s outline. Several examples of using the <section> element are presented below:
Example 1: In the following example, we see an article (part of a larger web document page) about tomatoes, containing several short sections:
<h2>Tasty, delicious, versatile produce!</h2>
<p>The tomato is one of the most popularly grown home garden plants.</p>
<p>This larger variety of tomato can take up to 120 days to mature, and grow up to 5" in diameter.</p>
<p>These tiny tomatoes are perfect for salads and snacking</p>
<p>Perfect for making sauces and salsas, the Roma variety also has great flavor.</p>
Example 2: This is a conference agenda separated into two sections, the opening plenary session and then the breakouts sessions:
<h1>Conference - Day 1</h1>
<p>Keynote Speaker Introduction</p>
<p>Presentation of Annual Achievement Award</p>
<p>State of the Department Address and Welcoming by Regional Director</p>
<li>Securing the Infrastructure</li>
<li>Web 2.0 Wiki and Blog's</li>
<li>Portal Community Workgroups</li>
<li>Internet Web Template 5.0</li>
<li>Writing for the Web</li>
This element represents the heading of a section within a web page document. The <hgroup> element is used to group any set of <h1 – h6> elements when the heading has multiple levels, such as is the case with subheadings, alternative titles, or taglines. <h1 – h6> sections may contain headings of any rank, but web authors are strongly encouraged to use elements of the appropriate rank for the section’s nesting level.
For the purposes of document summaries, outlines, and similar content, the text of <hgroup> elements is defined to be the text of the highest ranked <h1 – h6> element descendant of the <hgroup> element, if there are any such elements, and the first such element if there are multiple elements with that rank. If there are no such elements, then the text of the hgroup element is the empty string.
Here are some examples of valid headings using conforming code. In each case, the emphasized heading text represents the text that would be used as the heading in an application extracting heading data and ignoring the subheadings.
<h1>Lost in Shangri-La:</h1>
<h2>A True Story of Survival, Adventure, and the Most Incredible Rescue Mission of World War II</h2>
<h1>Blood, Bones & Butter:</h1>
<h2>The Inadvertent Education of a Reluctant Chef</h2>
The point of using <hgroup> in the examples above is to mask the <h2> element from the outline algorithm when browsers parse the web document coding.
In the next segment on HTML5 we will review the structural elements including header <header>, footer <footer>, navigation <nav> and more.