Semantic HTML Elements
Demonstrates semantic HTML5 elements for structuring content meaningfully, improving accessibility and SEO with proper document outline.
Code
<!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>© 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
WCAG Color Contrast CheckerCalculate WCAG 2.1 color contrast ratios between foreground and background colors. Verify AA and AAA compliance levels for normal and large text accessibility.JSON to Zod Schema ConverterInfer typed Zod z.object schemas from JSON payloads locally, supporting nested objects, merged array shapes, enums, nullable fields, and JSDoc comments.JSON Schema ValidatorValidate JSON data against a JSON Schema definition and get detailed error reports. Supports type checking, required fields, and common constraint validation.JSONL / NDJSON InspectorValidate NDJSON and JSON Lines line-by-line, pinpoint syntax errors by line number, analyze key frequencies and types, and export a pretty JSON array.
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.
Report a problem with this exampleOpens a pre-filled issue on GitHub.