Semantic HTML Elements

Demonstrates semantic HTML5 elements for structuring content meaningfully, improving accessibility and SEO with proper document outline.

HtmlForm Validation

Code

snippet
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Semantic HTML Example</title>
</head>
<body>
  <header>
    <h1>Page Title</h1>
    <p>Subtitle or tagline</p>
  </header>

  <main>
    <article>
      <h2>Article Title</h2>
      <p>Article content goes here.</p>
    </article>

    <section>
      <h2>Section Title</h2>
      <p>Section content.</p>
    </section>
  </main>

  <footer>
    <p>&copy; 2025 Example Site</p>
  </footer>
</body>
</html>

How the snippet works

The markup uses the semantic elements header, main, article, section and footer instead of generic containers, giving assistive technology and search engines real structure without extra wiring.

Statements that matter

<html lang="en">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

Interactive Tools for This Topic

FAQ

Why semantic elements instead of divs?
`<header>`, `<main>`, `<article>`, `<section>`, `<footer>` expose document structure to assistive technology and search engines without ARIA or class-name conventions.