Handout IST209 Handout IST209 HTML Semantic Elements
Handout IST209 Handout IST209 HTML Semantic Elements
❮ Previous Next ❯
Examples of nonsemantic elements: <div> and <span> Tells nothing about its content.
Examples of semantic elements: <form>, <table>, and <article> Clearly defines its
content.
Browser Support
In addition, you can "teach" older browsers how to handle "unknown elements".
HTML5 offers new semantic elements to define different parts of a web page:
<article>
<aside>
<details>
<figcaption>
<figure>
<footer>
<header>
<main>
<mark>
<nav>
<section>
<summary>
<time>
A home page could normally be split into sections for introduction, content, and contact
information.
Example
<section>
<h1>WWF</h1>
<p>The World Wide Fund for Nature (WWF) is....</p>
</section>
Try it Yourself »
Forum post
Blog post
Newspaper article
Example
<article>
<h1>What Does WWF Do?</h1>
<p>WWF's mission is to stop the degradation of our planet's natural
environment,
and build a future in which humans live in harmony with nature.</p>
</article>
Try it Yourself »
Can we use the definitions to decide how to nest those elements? No, we cannot!
So, on the Internet, you will find HTML pages with <section> elements containing <article>
elements, and <article> elements containing <sections> elements.
You will also find pages with <section> elements containing <section> elements, and
<article> elements containing <article> elements.
Example for a newspaper: The sport articles in the sport section, may have a technical
section in each article.
Example
<article>
<header>
<h1>What Does WWF Do?</h1>
<p>WWF's mission:</p>
</header>
<p>WWF's mission is to stop the degradation of our planet's natural
environment,
and build a future in which humans live in harmony with nature.</p>
</article>
Try it Yourself »
A footer typically contains the author of the document, copyright information, links to terms of
use, contact information, etc.
Example
<footer>
<p>Posted by: Hege Refsnes</p>
<p>Contact information: <a href="mailto:[email protected]">
[email protected]</a>.</p>
</footer>
Try it Yourself »
Notice that NOT all links of a document should be inside a <nav> element. The <nav>
element is intended only for major block of navigation links.
Example
<nav>
<a href="/html/">HTML</a> |
<a href="/css/">CSS</a> |
<a href="/js/">JavaScript</a> |
<a href="/jquery/">jQuery</a>
</nav>
Try it Yourself »
Example
<aside>
<h4>Epcot Center</h4>
<p>The Epcot Center is a theme park in Disney World, Florida.</p>
</aside>
Try it Yourself »
Example
<figure>
<img src="pic_mountain.jpg" alt="The Pulpit Rock" width="304"
height="228">
<figcaption>Fig1. ‐ The Pulpit Rock, Norway.</figcaption>
</figure>
Try it Yourself »
The <img> element defines the image, the <figcaption> element defines the caption.
This made it impossible for search engines to identify the correct web page content.
With the new HTML5 elements (<header> <footer> <nav> <section> <article>), this will
become easier.
According to the W3C, a Semantic Web: "Allows data to be shared and reused across
applications, enterprises, and communities."
Tag Description
<details> Defines additional details that the user can view or hide
❮ Previous Next ❯