HTML5 Fundamentals - Structure and Semantics for Modern Web Pages
HTML (HyperText Markup Language) is the foundation of every web page. HTML5 is the latest standard, introducing semantic elements, multimedia support, and powerful APIs.
Writing good HTML is about more than just making content appear on the screen — it's about structure, accessibility, and helping search engines understand your content.
This tutorial covers HTML5 semantic elements, forms, accessibility, and best practices for building well-structured web pages.
Semantic HTML5 Elements
Semantic elements clearly describe their meaning to both the browser and the developer. They improve accessibility, SEO, and code readability.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Page Title</title>
</head>
<body>
<header>
<nav aria-label="Main navigation">
<ul>
<li><a href="/">Home</a></li>
<li><a href="/about">About</a></li>
</ul>
</nav>
</header>
<main>
<article>
<h1>Article Title</h1>
<section>
<h2>Section Heading</h2>
<p>Content goes here.</p>
</section>
</article>
<aside>Related content</aside>
</main>
<footer>
<p>© 2026 CodeCrown</p>
</footer>
</body>
</html>
Using elements like header, nav, main, article, section, aside, and footer instead of generic divs improves both SEO and screen reader navigation.
HTML5 Forms and Input Types
HTML5 introduced many new input types and form attributes that provide built-in validation and better mobile keyboard support.
<form action="/submit" method="POST" novalidate>
<label for="name">Full Name</label>
<input type="text" id="name" name="name" required minlength="2" autocomplete="name">
<label for="email">Email Address</label>
<input type="email" id="email" name="email" required autocomplete="email">
<label for="phone">Phone Number</label>
<input type="tel" id="phone" name="phone" pattern="[0-9]{10}">
<label for="dob">Date of Birth</label>
<input type="date" id="dob" name="dob" max="2008-01-01">
<label for="range">Experience (years)</label>
<input type="range" id="range" name="experience" min="0" max="20" step="1">
<button type="submit">Submit</button>
</form>
HTML Accessibility (a11y)
Accessible HTML ensures your website can be used by everyone, including people who use screen readers or keyboard navigation.
<!-- Always use alt text for images -->
<img src="/profile.jpg" alt="Alice's profile photo" width="120" height="120">
<!-- Decorative images should have empty alt -->
<img src="/divider.png" alt="" role="presentation">
<!-- Accessible icon button -->
<button type="button" aria-label="Close dialog">
<svg aria-hidden="true">...</svg>
</button>
<!-- Skip navigation link for keyboard users -->
<a href="#main-content" class="skip-link">Skip to main content</a>
<!-- ARIA live region for dynamic content -->
<div aria-live="polite" aria-atomic="true" id="status"></div>
Always test with a keyboard (Tab, Shift+Tab, Enter, Space) and a screen reader like NVDA or VoiceOver to ensure accessibility.
HTML Meta Tags for SEO
- Always include a unique, descriptive title tag on every page
- Write a compelling meta description under 160 characters for each page
- Use the canonical tag to prevent duplicate content issues
- Include Open Graph and Twitter Card meta tags for social sharing
- Use the lang attribute on the html tag for language identification
- Add a viewport meta tag for proper mobile rendering
Conclusion
HTML5 is more powerful than ever. Semantic markup, accessible forms, and proper meta tags lay the groundwork for fast, discoverable, and inclusive web experiences.
Writing clean, semantic HTML is the first step to building websites that are easy to maintain, rank well in search engines, and work for all users.
Codecrown