Semantic HTML — Allowed
This unit follows Phase 1 and introduces meaningful page structure before CSS.
Learning goal
Choose HTML elements for the meaning and relationship of their content, not for their default appearance. Document pages that will ship publicly with basic metadata.
HTML tags allowed
Everything from ./phase1-allowed.html, plus:
apnavmainsectionarticleasidefooterfigurefigcaptionlink(in<head>forrel="icon"andrel="canonical")meta(in<head>forname="description"and Open Graph / Twitter properties)
Attributes allowed
- On
html:lang - On
a:href - On landmarks and sections:
id,aria-label,aria-labelledby - On
img:src,alt,width,height - On
meta:name,content,property - On
link:rel,href - Phase 1 control attributes remain available
Semantic rules
- Use one visible
mainfor the page’s unique primary content. - Keep repeated site navigation, page headers, and page footers outside
main. - Use
sectionfor a thematic group that normally has a heading. - Use
articlewhen the content could stand independently or be reused elsewhere. - Use
asidefor complementary content, not merely because something appears in a sidebar. headerandfootermay describe the whole page or the nearest section/article.- Use
navfor major groups of navigation links, not every isolated link. - Give multiple navigation regions distinct accessible names.
- Use
figurewithfigcaptionwhen media and its caption form one referenced unit. - Keep
divwhen no semantic element accurately describes the group. - Prefer native HTML meaning over adding a redundant ARIA role.
- Maintain a logical heading hierarchy that describes the document.
- Public pages should include a unique title, meta description, favicon, and Open Graph tags; add canonical when URL variants exist.
- If help appears on multiple pages, keep it in the same relative order (Consistent Help).
Not allowed
- CSS
- JavaScript
- Inline styles
- HTML tags or attributes not listed here or inherited from Phase 1
Pages
01-landmarks.html— page header, navigation, main content, and footer02-section-article.html— thematic sections and independent articles03-aside-figure.html— complementary content, figures, and generic groups04-complete-page.html— combine the semantic elements into one document05-alt-rewrite.html— rewrite filename-echoalttext into meaningful descriptions06-document-metadata.html— title, description, canonical, icon, Open Graph