Semantic elements
header, nav, main, section, article, aside, footer, figure, time and address versus div and span: choosing the element that says what each zone holds, and what that brings to screen readers and search engines.
- 23 cards
- 4 topics
- Free
The outline, topic by topic
Each topic is weighted the way the exam weighs it.
- Concepts
- Questions
- Sort and link
- Scenarios
A few cards from the deck
Semantic HTML: what is it?
Show the answer
Using tags according to the meaning of the content they wrap, rather than the look wanted, so software understands the structure of the page.
A screen reader can jump straight to the menu or the content if those zones are marked up. A page made of
divoffers no landmarks.How many visible
mainelements does a page contain?- Just one
- One per
section - One per
article - As many as you want
Show the answer
Just one
maindesignates the main content of the page: by definition it is unique. Screen readers offer to jump straight to it, and severalmainmake that shortcut ambiguous.The … element wraps a group of main navigation links, and the … element the page footer, with legal notices or contacts.
Show the answer
The nav element wraps a group of main navigation links, and the footer element the page footer, with legal notices or contacts.
Not every link goes in a
nav: it is reserved for major navigation blocks (main menu, table of contents), not for a mere list of links inside an article.main: what is it?
Show the answer
A tag that wraps the content specific to the page, the part that is not repeated from page to page on the site.
There is only one per page (visible). The banner, menu and footer, shared across the site, stay outside it.
A page is made only of
div: a screen reader finds no landmark in it. What should change first?- Give each
divof the page a different, meaningful CSS class - Use
header,nav,mainandfooterfor the big zones - Add a unique, explicit
idto eachdivof the page - Replace each
divwith aspan
Show the answer
Use
header,nav,mainandfooterfor the big zonesClasses and
idonly speak to CSS and JavaScript. A screen reader does read the text insidediv, but only semantic elements give it landmarks, hence its shortcuts to the menu or the content.spanhas no more meaning thandiv.- Give each