HTML5 semantic elements
HTML5 also introduces several semantic elements. These elements can be styled using CSS but their purpose is simply to act as semantic elements.
These elements help define the meaning of the HTML contained within them to the developer, browser and any crawler (such as Google) and help to distinguish parts of the webpage.
In this tutorial so far, elements such as
<span> have been discussed. These elements
are not semantic as they do not describe what they do.
Other elements discussed in this tutorial that provide a definition from their
tag names include
These elements clearly have a specific purpose, with the
tag designed to contain a paragraph of text whereas the
tag is designed to contain a table of information.
HTML5 introduces more of these and they should be used where possible. This website uses many semantic elements from the HTML5 standard.
Semantic elements don't just make it easier for the users of the website or for the crawlers from search engines, they also give the site a better ranking.
They also make the content much easier to develop and understand, much in the same way that comments do in programming languages.
There are several semantic elements in HTML going from the top of the page to the bottom:
header element is used to define a header section
of a document. This section usually contains things like the logo or icon for the website
and a search bar. It is also common to see the navigation bar for the website within this section.
nav element is defines a block of navigation based links, for
example on this website the main menu bar at the top is wrapped within a
element since it is a collection of links for the website.
It is important to note that not
all links on the webpage should be wrapped in this element but only those used for
navigation around the website. For example, the site links zone of this website
does not reside within a
Another common place to find this element is around breadcrumbs on a webpage.
main element is used to define the main content of
the webpage. For example, on this website there is a sidebar and a main content
section. The main content of each webpage on this website is within a
article element is used to define self-contained content.
For example, each review on this website is contained within an
element since the content within the reviews is self-contained and independent of the
content around it.
section element is used to define a section of logically
connected content. A webpage may contain several of these sections.
aside element is used to describe additional information
or, in some cases, a sidebar.
footer element is used to define a footer section of
a webpage. Normally, and by HTML5 rules, this contains the copyright information of the website
as well as some contact information and site links.