
HTML5 is the latest major version of HTML, designed to make web pages more powerful, interactive, and accessible without needing extra plugins like Flash or Silverlight.
1. New Semantic Elements
HTML5 introduced tags that clearly describe content structure, improving readability, SEO, and accessibility.
Tag | Purpose |
---|---|
<header> | Page or section header |
<nav> | Navigation menu |
<main> | Main content area |
<section> | Thematic grouping of content |
<article> | Self-contained piece (blog post, news item) |
<aside> | Sidebar or related content |
<footer> | Page or section footer |
<figure> | Image, diagram, or illustration |
<figcaption> | Caption for a figure |
<mark> | Highlighted text |
<time> | Represents time/date |
2. Multimedia Support
Native tags for audio and video so you don’t need plugins.
<audio controls src="music.mp3"></audio>
<video controls width="320" height="240" src="movie.mp4"></video>
✅ Supports multiple formats (.mp4
, .ogg
, .webm
).
3. New Form Input Types
HTML5 added more specific input types to make forms smarter and user-friendly:
email
url
tel
date
/time
/datetime-local
number
range
color
search
Example:
<input type="email" placeholder="Enter your email">
4. New Form Attributes
placeholder
→ Hint text inside input.required
→ Makes input mandatory.pattern
→ Regex validation.autocomplete
→ Suggests saved values.autofocus
→ Focuses on input when page loads.min
,max
,step
→ Range controls.
5. Graphics & Animation
<canvas>
→ Draw shapes, graphics, animations using JavaScript.- SVG (Scalable Vector Graphics) → Resolution-independent graphics.
Example:
<canvas id="myCanvas" width="200" height="100"></canvas>
6. APIs & Advanced Features
HTML5 introduced several JavaScript APIs for dynamic and interactive features:
- Geolocation API → Find user’s location.
- Local Storage / Session Storage → Store data in browser without cookies.
- Offline Web Apps → Work without internet connection.
- Drag and Drop API → Allow dragging elements.
- Web Workers → Background processing for better performance.
7. Deprecated Elements
Some old HTML4 tags were removed in HTML5 (should be replaced with CSS or new semantic tags):
<font>
→ use CSS instead.<center>
→ use CSStext-align: center;
.<big>
,<strike>
→ use CSS.<frame>
,<frameset>
,<noframes>
→ replaced by<iframe>
and CSS layout.
✅ Why HTML5 is Important:
- Cleaner, more meaningful code.
- Better performance on mobile devices.
- Cross-browser multimedia support.
- Native form validation and interactive features.