This complete HTML tutorial covers 79 topics — from document structure and elements to forms, semantic HTML, media, browser APIs, accessibility, SEO-friendly markup, and a final multi-page website project.
Course roadmap
- Introduction to HTML
- What is HTML?
- HTML Syntax
- HTML Document Structure
- HTML5 Introduction
- HTML Doctype
- HTML Comments
- HTML Elements
- HTML Attributes
- HTML Headings
- HTML Paragraphs
- HTML Text Formatting
- HTML Links and Anchors
- HTML Images
- HTML Audio
- HTML Video
- HTML Lists
- HTML Ordered Lists
- HTML Unordered Lists
- HTML Description Lists
- HTML Tables
- HTML Table Rows and Columns
- HTML Table Headers and Footers
- HTML Forms
- HTML Form Attributes
- HTML Input Fields
- HTML Input Types
- HTML Textarea
- HTML Select and Option
- HTML Checkbox
- HTML Radio Buttons
- HTML File Upload
- HTML Date and Time Inputs
- HTML Email and URL Inputs
- HTML Form Validation
- HTML Buttons
- HTML Labels
- HTML Fieldset and Legend
- Semantic HTML
- HTML Header Element
- HTML Navigation Element
- HTML Main Element
- HTML Section Element
- HTML Article Element
- HTML Aside Element
- HTML Footer Element
- HTML Div and Span
- Block vs Inline Elements in HTML
- HTML Entities
- HTML Symbols
- HTML Meta Tags
- SEO Meta Tags in HTML
- HTML Viewport Meta Tag
- HTML Favicon
- HTML Links and External Resources
- HTML iframe
- Embedding External Content in HTML
- HTML5 Canvas
- SVG in HTML
- HTML Geolocation API
- HTML Drag and Drop
- HTML Web Storage API
- HTML Local Storage
- HTML Session Storage
- HTML Media API
- Responsive HTML
- Accessibility in HTML
- ARIA Attributes in HTML
- Accessible Forms in HTML
- Keyboard Accessibility in HTML
- HTML Validation
- W3C Standards for HTML
- SEO-Friendly HTML
- HTML Performance Optimization
- Clean and Maintainable HTML
- HTML Best Practices
- HTML Interview Questions
- Building a Responsive Website with HTML
- Final Project – Complete HTML Website
1. Introduction to HTML
HTML (HyperText Markup Language) structures web content. This series covers syntax, media, forms, HTML5 APIs, SEO-friendly markup, accessibility, and a complete HTML website project.
- Learn document structure and core tags.
- Build forms and semantic layouts.
- Ship a complete responsive HTML website.
Learning path
Structure + elements
Media + tables + forms
Semantic HTML
APIs + accessibility
SEO + best practices
Final HTML website
2. What is HTML?
Browsers parse HTML into a DOM tree. HTML describes structure and meaning; CSS styles it; JavaScript makes it interactive.
HTML role
Structure & meaning → HTML
Presentation → CSS
Behavior → JavaScript
3. HTML Syntax
Most elements have opening/closing tags. Void elements like `img` and `br` do not wrap content.
Syntax basics
<p class="lead">Hello <strong>world</strong></p>
<img src="photo.jpg" alt="A lake at sunset">
4. HTML Document Structure
Every page needs a doctype, language, head metadata, and body content.
Minimal page
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Page title</title>
</head>
<body>
<h1>Hello</h1>
</body>
</html>
5. HTML5 Introduction
HTML5 modernized markup with native audio/video, better forms, canvas/svg, and semantic sections.
HTML5 highlights
Semantic sections
Native audio/video
New input types
Canvas & SVG
Local storage & more APIs
6. HTML Doctype
The HTML5 doctype is short and required at the top of every document.
Doctype
<!DOCTYPE html>
7. HTML Comments
Comments are not shown to users. Don’t put secrets in comments.
Comment
<!-- Navigation starts here -->
8. HTML Elements
Elements nest to form the document tree. Nest correctly — don’t overlap tags.
Nesting
<article>
<h2>Title</h2>
<p>Paragraph text.</p>
</article>
9. HTML Attributes
Boolean attributes (e.g. `required`, `disabled`) can be written without values in HTML.
Attributes
<a id="docs" class="btn" href="/docs" target="_blank" rel="noopener">Docs</a>
10. HTML Headings
Use one main h1 per page (typical). Don’t skip levels randomly for styling.
Headings
<h1>Site section</h1>
<h2>Topic</h2>
<h3>Subtopic</h3>
11. HTML Paragraphs
Browsers add default spacing between paragraphs. Prefer paragraphs over `<br>` spam for text blocks.
Paragraph
<p>HTML describes the structure of web pages.</p>
12. HTML Text Formatting
Prefer semantic emphasis (`strong`/`em`) over presentational tags when meaning matters.
Formatting
<p><strong>Important</strong> and <em>stressed</em> text.
<code>inline code</code> and <mark>highlight</mark>.</p>
13. HTML Links and Anchors
Use descriptive link text. For new tabs, add `rel="noopener noreferrer"` with `target="_blank"`.
Links
<a href="/about">About us</a>
<a href="#pricing">Jump to pricing</a>
<a href="https://example.com" target="_blank" rel="noopener">External</a>
14. HTML Images
Always include `alt`. Use width/height or CSS to reduce layout shift.
Image
<img src="assets/hero.jpg" alt="Team collaborating in a bright office" width="1200" height="800">
15. HTML Audio
Provide multiple sources when needed and visible controls for usability.
Audio
<audio controls>
<source src="audio/intro.mp3" type="audio/mpeg">
Your browser does not support audio.
</audio>
16. HTML Video
Include `controls`, a poster image, and captions via tracks when possible.
Video
<video controls poster="poster.jpg" width="640">
<source src="video/demo.mp4" type="video/mp4">
<track kind="captions" src="captions-en.vtt" srclang="en" label="English">
</video>
17. HTML Lists
Lists improve scannability and convey structure to assistive tech.
List types
ul → bullets
ol → numbered
dl → term/description pairs
18. HTML Ordered Lists
Use `start` and `type` carefully; prefer CSS for presentation when possible.
Ordered list
<ol>
<li>Install editor</li>
<li>Create index.html</li>
<li>Open in browser</li>
</ol>
19. HTML Unordered Lists
Common for nav menus and feature bullets.
Unordered list
<ul>
<li>Fast</li>
<li>Accessible</li>
<li>Semantic</li>
</ul>
20. HTML Description Lists
Ideal for glossaries, FAQs, and metadata pairs.
Description list
<dl>
<dt>HTML</dt>
<dd>Markup language for web documents.</dd>
</dl>
21. HTML Tables
Use tables for data — not page layout.
Simple table
<table>
<thead><tr><th>Name</th><th>Role</th></tr></thead>
<tbody><tr><td>Asha</td><td>Editor</td></tr></tbody>
</table>
22. HTML Table Rows and Columns
Keep structures simple for accessibility.
Colspan
<tr>
<td colspan="2">Full-width note</td>
</tr>
23. HTML Table Headers and Footers
`scope="col"` / `scope="row"` helps screen readers associate headers.
Scoped header
<th scope="col">Price</th>
24. HTML Forms
Always specify `action` and `method` (or handle via JS). Group fields with labels.
Form shell
<form action="/subscribe" method="post">
<!-- fields -->
<button type="submit">Subscribe</button>
</form>
25. HTML Form Attributes
Use `enctype="multipart/form-data"` for file uploads.
Useful attributes
action, method
enctype
novalidate
autocomplete
name (on controls)
26. HTML Input Fields
Every input should have an accessible name via label `for`/`id` or wrapping.
Labeled input
<label for="name">Name</label>
<input id="name" name="name" type="text" autocomplete="name">
27. HTML Input Types
Correct types improve mobile keyboards and built-in validation.
Input types
text, email, url, tel
number, password, search
checkbox, radio, file
date, time, color, range
28. HTML Textarea
Set rows/cols or CSS sizing; include a label.
Textarea
<label for="msg">Message</label>
<textarea id="msg" name="message" rows="5"></textarea>
29. HTML Select and Option
Use a first placeholder option carefully; mark required selects properly.
Select
<label for="country">Country</label>
<select id="country" name="country">
<option value="">Choose…</option>
<option value="in">India</option>
<option value="us">United States</option>
</select>
30. HTML Checkbox
Use the same `name` with different values for groups, or unique names for independent toggles.
Checkbox
<label><input type="checkbox" name="interests" value="seo"> SEO</label>
31. HTML Radio Buttons
One name group = one selected value.
Radios
<label><input type="radio" name="plan" value="free" checked> Free</label>
<label><input type="radio" name="plan" value="pro"> Pro</label>
32. HTML File Upload
Set `accept` for hints; remember server-side validation is mandatory.
File input
<label for="resume">Resume</label>
<input id="resume" type="file" name="resume" accept=".pdf,.doc,.docx">
33. HTML Date and Time Inputs
Support varies by browser — still validate on the server.
Date input
<label for="day">Date</label>
<input id="day" type="date" name="day">
34. HTML Email and URL Inputs
Browsers provide format checks; still sanitize server-side.
Email & URL
<input type="email" name="email" autocomplete="email" required>
<input type="url" name="website" placeholder="https://">
35. HTML Form Validation
Native validation is a first line — never the only line.
Validation attrs
<input type="text" name="zip" required pattern="[0-9]{5,6}" title="5–6 digit ZIP">
36. HTML Buttons
Inside forms, default type is submit — set `type="button"` for non-submit actions.
Buttons
<button type="submit">Save</button>
<button type="button">Cancel</button>
<button type="reset">Reset</button>
37. HTML Labels
Clicking a label focuses its control — better tap targets on mobile.
Label patterns
<label for="email">Email</label>
<input id="email" type="email" name="email">
<label><input type="checkbox" name="tos"> I agree</label>
38. HTML Fieldset and Legend
Especially helpful for radio/checkbox groups and multi-section forms.
Fieldset
<fieldset>
<legend>Shipping method</legend>
<label><input type="radio" name="ship" value="std"> Standard</label>
<label><input type="radio" name="ship" value="exp"> Express</label>
</fieldset>
39. Semantic HTML
Semantics improve accessibility, SEO, and maintainability.
Semantic mindset
Prefer header/nav/main/article/section/aside/footer
over anonymous div soup when meaning exists
40. HTML Header Element
Can be page-level or section-level (e.g., article header).
Header
<header>
<p class="brand">SiteName</p>
<nav><!-- links --></nav>
</header>
41. HTML Navigation Element
Don’t put every link group in nav — reserve for primary navigation regions.
Nav
<nav aria-label="Primary">
<ul>
<li><a href="/">Home</a></li>
<li><a href="/blog">Blog</a></li>
</ul>
</nav>
42. HTML Main Element
Skip links often target main. One main per page.
Main
<main id="content">
<h1>Article title</h1>
<p>...</p>
</main>
43. HTML Section Element
If it needs a heading and represents a standalone theme, section is a good fit.
Section
<section>
<h2>Features</h2>
<p>…</p>
</section>
44. HTML Article Element
Blog posts, news items, and product cards often fit article.
Article
<article>
<h2>Post title</h2>
<p>Self-contained content…</p>
</article>
45. HTML Aside Element
Sidebars, pull quotes, and related links are common uses.
Aside
<aside>
<h2>Related</h2>
<ul><!-- links --></ul>
</aside>
46. HTML Footer Element
Copyright, secondary nav, and contact details often live here.
Footer
<footer>
<p>© 2026 Example Co.</p>
</footer>
47. HTML Div and Span
Prefer semantic tags first; use div/span for styling hooks and grouping without meaning.
Div vs span
<div class="card">Block container</div>
<span class="badge">Inline wrapper</span>
48. Block vs Inline Elements in HTML
Block starts on a new line and spans width; inline flows within text. CSS can change display.
Examples
Block: div, p, section, ul
Inline: a, span, strong, img (replaced)
49. HTML Entities
Use `<`, `>`, `&`, `"` when showing markup as text.
Entities
<p>Use & for ampersands and <code> for code tags.</p>
50. HTML Symbols
Prefer real Unicode in UTF-8 documents; entities remain useful for clarity.
Symbols
<p>Copyright © · Arrow → · Euro €</p>
51. HTML Meta Tags
Charset, viewport, description, and robots are foundational meta tags.
Common meta
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="A short page summary.">
52. SEO Meta Tags in HTML
Title + description influence CTR; keep them unique and accurate.
SEO head sample
<title>HTML Tutorial – Learn Semantic Markup</title>
<meta name="description" content="Complete HTML tutorial covering elements, forms, and accessibility.">
<meta name="robots" content="index, follow">
53. HTML Viewport Meta Tag
Essential for responsive layouts on phones.
Viewport
<meta name="viewport" content="width=device-width, initial-scale=1">
54. HTML Favicon
Provide multiple sizes for crisp browser and home-screen icons.
Favicon links
<link rel="icon" href="/favicon.ico" sizes="any">
<link rel="icon" type="image/png" href="/icon-32.png" sizes="32x32">
55. HTML Links and External Resources
Prefer defer/async for non-critical JS; put CSS in head.
Resources
<link rel="stylesheet" href="/styles.css">
<script src="/app.js" defer></script>
56. HTML iframe
Use sparingly; set title for accessibility and sandbox when embedding untrusted content.
iframe
<iframe src="https://example.com/map" title="Office location map" loading="lazy"></iframe>
57. Embedding External Content in HTML
Prefer privacy-friendly embeds; lazy-load when possible; provide titles/fallbacks.
Embed tip
Native video/audio when you host files
iframe for third-party widgets
title + lazy loading
privacy/consent considerations
58. HTML5 Canvas
Canvas is a drawing surface — provide fallback text and accessible alternatives when needed.
Canvas
<canvas id="chart" width="400" height="200">Chart fallback text</canvas>
59. SVG in HTML
Inline SVG can be styled/accessible; decorative SVGs should be hidden from AT appropriately.
Inline SVG
<svg width="24" height="24" aria-hidden="true" focusable="false">
<circle cx="12" cy="12" r="10" fill="currentColor" />
</svg>
60. HTML Geolocation API
Requires HTTPS in modern browsers; always explain why you need location.
Geolocation idea
navigator.geolocation.getCurrentPosition((pos) => {
console.log(pos.coords.latitude, pos.coords.longitude);
});
61. HTML Drag and Drop
Consider keyboard alternatives for accessibility.
Draggable
<div draggable="true" id="item">Drag me</div>
62. HTML Web Storage API
localStorage persists; sessionStorage lasts for the tab session. Don’t store secrets.
Web Storage
localStorage → persistent
sessionStorage → per-tab session
Both → string key/value
63. HTML Local Storage
Good for preferences and lightweight caches — not sensitive tokens if XSS is possible.
localStorage
localStorage.setItem('theme', 'dark');
const theme = localStorage.getItem('theme');
64. HTML Session Storage
Useful for wizard steps or one-visit UI state.
sessionStorage
sessionStorage.setItem('step', '2');
65. HTML Media API
Play/pause, volume, and time updates via JavaScript events.
Media control idea
const video = document.querySelector('video');
video.play();
video.pause();
66. Responsive HTML
Use viewport meta, flexible media, and meaningful source sets.
Responsive image
<img
src="hero-800.jpg"
srcset="hero-800.jpg 800w, hero-1200.jpg 1200w"
sizes="(max-width: 800px) 100vw, 800px"
alt="Mountain trail at sunrise">
67. Accessibility in HTML
Good HTML is the foundation of a11y — fix structure before adding ARIA.
A11y basics
Semantic landmarks
Labeled controls
Keyboard operable
Visible focus
Meaningful alt text
68. ARIA Attributes in HTML
First rule of ARIA: don’t use ARIA if a native element works.
ARIA example
<button aria-expanded="false" aria-controls="menu">Menu</button>
<ul id="menu" hidden>...</ul>
69. Accessible Forms in HTML
Labels, instructions, error text associations, and fieldsets matter.
Accessible error idea
<label for="email">Email</label>
<input id="email" type="email" aria-describedby="email-err" aria-invalid="true">
<p id="email-err">Enter a valid email.</p>
70. Keyboard Accessibility in HTML
Don’t remove focus outlines without a visible replacement.
Keyboard tip
Native controls first
Tab order logical
Focus visible
No keyboard traps
71. HTML Validation
Use the W3C Nu Html Checker and fix real errors before shipping.
Validation habit
Paste URL or source into validator
Fix errors first, then warnings
Re-check after large edits
72. W3C Standards for HTML
Standards keep sites interoperable across browsers.
Standards tip
Prefer documented elements/APIs
Avoid proprietary-only markup
Test in multiple browsers
73. SEO-Friendly HTML
Clear titles, headings, links, and semantic structure help search engines understand pages.
SEO HTML checklist
Unique title + description
One clear H1
Descriptive anchors
Semantic landmarks
Fast, accessible media
74. HTML Performance Optimization
Reduce DOM size; lazy-load below-the-fold images/iframes.
Perf tips
Minimize DOM depth/size
loading="lazy" on non-critical media
defer scripts
Preload only true LCP assets
75. Clean and Maintainable HTML
Avoid unnecessary wrappers; comment sparingly; keep component patterns consistent.
Maintainability
Consistent indent
Meaningful class names
Fewer nested wrappers
Reusable partials/includes when available
76. HTML Best Practices
Ship valid, accessible, SEO-aware HTML as your default standard.
Best practices
Semantic first
Label everything interactive
Validate often
Optimize media
Progressive enhancement
77. HTML Interview Questions
Be ready to explain semantic tags, forms, accessibility, and block vs inline.
Sample Q&A
Q: Block vs inline?
A: Block starts new line & full width by default; inline flows in text.
Q: Why labels?
A: Accessibility + larger hit area + clearer UX.
Q: Article vs section?
A: Article is self-contained; section is thematic grouping with heading.
78. Building a Responsive Website with HTML
Structure first (header/main/footer), then layer CSS for breakpoints.
Page skeleton
<body>
<header>...</header>
<main>
<section id="hero">...</section>
<section id="features">...</section>
</main>
<footer>...</footer>
</body>
79. Final Project – Complete HTML Website
Create a small marketing site (Home, About, Services, Contact) with navigation, responsive images, a validated contact form, SEO meta tags, and clean maintainable markup. Validate with W3C and test keyboard access.
- Plan IA and shared layout.
- Build semantic pages and navigation.
- Add form, meta, and a11y polish.
- Validate and test on mobile + keyboard.
Final project scope
1. 3–5 semantic pages
2. Shared header/nav/footer pattern
3. Responsive images + viewport meta
4. Contact form with labels + validation attrs
5. Accessible landmarks + skip link
6. SEO title/description per page
7. Favicon + basic performance hygiene
8. W3C validation pass
Suggested pages
index.html
about.html
services.html
contact.html
Conclusion
You now have a full HTML path: structure, media, forms, semantics, accessibility, and performance-minded markup. Finish the final website project to turn the lessons into a portfolio-ready site.