Landmarks and where to put them - HTMHell
A collection of bad practices in HTML, copied from real websites.
Here’s an overview of the landmark elements in HTML, their ARIA role and what they mean:
complementary) can be used to show content that is complementary to the main subject of the page. For example, links to related documents or meta info related to the main subject.
contentinfo) is where you put all the information about a page. Typically that’s things like copyright info, related links, the author
form) can be a landmark element if it has a accessible name (set with
banner) is where your page’s “introduction” goes. Things like your logo, search and main navigation all go in here.
main) contains the main content or functionality of your page.
navigation) is where you provide navigational links. They can be for your entire website (think your main menu), but also for your current page (think table of contents).
region) This is a “generic standalone section of a page”. Essentially, if you have a part of the page that stands alone, try to go down this list and if none of them fit but it’s still a separate part of the page, use a section. Like
forms, it’ll only be a landmark if it also has an accessible name.
- There is still one more landmark that we need to discuss: the
searchlandmark. All the landmarks above are HTML elements with a specific landmark role, but the
searchlandmark role has no associated HTML element. It only exists in ARIA. As you might guess, the search landmark is used to indicate search functionality and practically, you’d add a
searchrole to a
formelement to change it from a generic form to a search form.