HTML5 Introduction
HTML5 is the modern version of HTML used to create the structure and content of websites and web applications.
It introduced many useful features such as semantic elements, modern form controls, audio, video, graphics, and interactive HTML elements.
1. What is HTML5?
HTML5 is a major version of HTML designed to support modern web development. It provides better structure, improved form features, multimedia support, and graphical capabilities.
HTML5 works together with CSS and JavaScript:
- HTML5 - Structure and content
- CSS - Styling and layout
- JavaScript - Logic and interactivity
2. HTML5 at a Glance
Structure
Features
This diagram shows the major areas where HTML5 provides useful functionality for modern websites.
3. Why was HTML5 Needed?
Earlier versions of HTML focused mainly on structuring text, links, images, tables, and forms.
Modern websites needed richer capabilities such as multimedia, better page structure, more useful forms, and graphics. HTML5 introduced standard HTML features for many of these requirements.
4. Semantic Elements
HTML5 introduced semantic elements that clearly describe different parts of a page.
Examples:
<header><nav><main><section><article><aside><footer>
These elements make the structure of a webpage easier to understand.
5. New Form Input Types
HTML5 added several input types for common data.
| Input Type | Typical Use |
|---|---|
email |
Email address |
number |
Numeric values |
date |
Date selection |
time |
Time selection |
url |
Website URL |
range |
Value range |
color |
Color selection |
search |
Search input |
6. Audio Support
HTML5 provides the <audio> element for embedding
audio content directly in a webpage.
<audio controls>
<source src="audio.mp3" type="audio/mpeg">
</audio>
The browser can provide controls such as play, pause, and volume.
7. Video Support
HTML5 also introduced the <video> element for
embedding video content.
<video controls width="500">
<source src="video.mp4" type="video/mp4">
</video>
This makes video integration much simpler than relying on older browser-specific solutions.
8. Canvas
The <canvas> element provides an area where
graphics can be drawn using JavaScript.
<canvas id="myCanvas"
width="300"
height="150">
</canvas>
Canvas can be used for games, drawings, charts, animations, and other dynamic graphics.
9. SVG
SVG stands for Scalable Vector Graphics. It is useful for vector-based graphics such as icons, diagrams, and illustrations.
<svg width="120" height="80">
<circle
cx="60"
cy="40"
r="30">
</circle>
</svg>
10. Progress Element
The <progress> element shows the progress
of a task.
<progress value="70"
max="100">
</progress>
11. Details and Summary
HTML5 provides <details> and
<summary> for expandable content.
<details>
<summary>
What is HTML5?
</summary>
<p>
HTML5 provides modern features for web development.
</p>
</details>
What is HTML5?
HTML5 provides modern HTML features for building structured and interactive web content.
12. Custom Data Attributes
HTML5 allows developers to store custom application data using
attributes that begin with data-.
<button
data-course="html"
data-level="beginner">
Start Course
</button>
JavaScript can later read these values when needed.
13. HTML5 and JavaScript
HTML5 provides the structure and browser features, while JavaScript can make those features dynamic.
For example, JavaScript can draw inside a canvas, read custom data attributes, update progress, or control interactive elements.
14. HTML5 and CSS
HTML5 does not replace CSS. HTML defines the structure and meaning of the content, while CSS controls how that content looks.
| Technology | Main Responsibility |
|---|---|
| HTML5 | Structure and content |
| CSS | Design and layout |
| JavaScript | Logic and interaction |
15. Advantages of HTML5
- Provides meaningful semantic elements.
- Supports native audio and video.
- Provides improved form input types.
- Supports graphics with Canvas and SVG.
- Provides interactive elements such as Details and Summary.
- Supports custom data attributes.
- Works together with CSS and JavaScript for modern web applications.
16. Simple HTML5 Page
A basic HTML5 page can be written using the HTML5 doctype and semantic elements.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, initial-scale=1.0">
<title>
HTML5 Page
</title>
</head>
<body>
<header>
<h1>
My HTML5 Website
</h1>
</header>
<nav>
<a href="#">Home</a>
<a href="#">Courses</a>
</nav>
<main>
<section>
<h2>
Welcome
</h2>
<p>
Learn modern HTML5 features.
</p>
</section>
</main>
<footer>
<p>
© 2026 My Website
</p>
</footer>
</body>
</html>
17. Common Mistakes
Mistake 1: Thinking HTML5 does everything
HTML5 provides structure and many built-in browser features, but CSS is still needed for styling and JavaScript for application logic.
Mistake 2: Using semantic elements only for appearance
Semantic elements should be selected according to the meaning of the content, not simply because of how they look.
Mistake 3: Ignoring responsive design
HTML5 provides structure, but responsive layouts normally require CSS techniques such as flexible layouts and media queries.
18. Best Practices
- Use semantic elements whenever they match the content.
- Use appropriate HTML5 input types for forms.
- Use native audio and video elements where appropriate.
- Choose Canvas or SVG according to the graphics requirement.
- Keep HTML, CSS, and JavaScript responsibilities separate.
- Test important features in supported browsers.
19. Practice Example
Create an HTML5 page with:
- A semantic header
- A navigation menu
- A main content section
- A progress indicator
- A footer
<header>
<h1>HTML5 Course</h1>
</header>
<nav>
<a href="#">Home</a>
<a href="#">Lessons</a>
</nav>
<main>
<section>
<h2>
Course Progress
</h2>
<progress value="60"
max="100">
</progress>
</section>
</main>
<footer>
<p>
© 2026 HTML5 Course
</p>
</footer>
Summary
HTML5 is a modern version of HTML that provides semantic elements, better form controls, multimedia support, graphics, progress indicators, interactive elements, and custom data attributes. HTML5 handles structure and content, CSS handles presentation, and JavaScript handles dynamic behavior and application logic.