
When designing your web page, the first step is to define its regions. These are helpful for assistive technology users. They enable people to understand the overall structure of the content and move from section to section quickly.
Using semantic HTML, in addition to ARIA attributes, you will indicate the regions that are dedicated to navigation, main content, and elements like the search bar, header, and footer.
In this chapter, we'll focus on laying the groundwork using semantic HTML.
What does semantic mean?
By contrast, neutral tags like div or span don't convey information about the content's role.
Using the right HTML5 tags to structure your page makes it easier to understand and read using assistive technologies, creating a better user experience. The assistive technologies won't be able to translate the site well if the tags are improperly used or absent.
With the help of HTML5, you can natively give meaning to regions on your page.
The header tag may contain the logo, a search bar, and a navigation menu.
It can also be used inside an article or section tag. In this case, the header is only associated with the section and not with the entire page.
The nav tag, contains the links that navigate to other pages. The example below is a navigation menu adapted from the Bootstrap 4.4 documentation:
<!-- Navigation menu -->
<nav class="collapse bd-links" id="bd-docs-nav">
<div class="bd-toc-item active">
<a class="bd-toc-link" href="/docs/4.4/getting-started/introduction/">
Getting started
</a>
<ul class="nav bd-sidenav">
<li class="active bd-sidenav-active">
<a href="/docs/4.4/getting-started/introduction/">
Introduction
</a>
</li>
<li>
<a href="/docs/4.4/getting-started/download/">
Download
</a>
</li>
<li>
<a href="/docs/4.4/getting-started/contents/">
Contents
</a>
</li>
</ul>
</div>
</nav>The content of the main region changes from page to page (unlike your navigation menu). The main region usually starts with an h1 level heading that describes the overall topic of the page.
A section tag contains a single subject or functionality. It usually starts with a heading.
The article tag is not limited to a newspaper, magazine, or blog article. It can contain any standalone content, such as a cooking recipe.
The aside tag contains content that is complementary to the main content.
The footer tag creates a concluding region for the entire page, or for a section or article.
As with navigation, if you have multiple footers on a page, you will have to add an aria-label to define how this region is different from the other footer tags on your page.
A good approach to accessibility begins with the proper use of HTML5 tags.
Semantics in HTML is the use of meaningful tags.
Now that you know how to correctly create a basic web page structure, let's improve the structure's accessibility using ARIA roles and attributes. Then you'll what you've learned to our "Tonight in Gotham" project.