HTML5 APIs, Responsive Design & Accessibility
The full API picture, responsive techniques, and making HTML5 accessible.
HTML5 APIs — The Full Picture
| API | Purpose |
|---|---|
| Canvas 2D API | Draw shapes, text and images via JavaScript |
| Web Workers API | Background threads for heavy computation |
| History API | Manipulate browser history without a page reload |
| Fetch API | Modern replacement for XMLHttpRequest |
| Web Storage API | localStorage and sessionStorage |
| Drag & Drop API | Native drag-and-drop interactions |
| Notifications API | Display native desktop notifications |
| Fullscreen API | Request fullscreen for any element |
| Geolocation | Access user location with permission |
| File API | Read local files in the browser |
| WebSocket API | Full-duplex real-time communication |
| Server-Sent Events | Push data from server to browser |
HTML5 & Responsive Web Design
Viewport meta tag
<meta name="viewport" content="width=device-width, initial-scale=1">
Controls how the browser scales the page on mobile devices — essential for all responsive sites.
Flexible images
img { max-width: 100%; height: auto; }
CSS media queries
@media (max-width: 768px) {
.sidebar { display: none; }
.main { width: 100%; }
}
CSS Grid & Flexbox
.grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}
Modern CSS layout systems replace table-based and float-based layouts with responsive-friendly alternatives.
HTML5 & Web Accessibility
| Practice | Detail |
|---|---|
| Semantic HTML5 elements | Screen readers understand <nav>, <main>, <article> — no extra ARIA needed for basic structure. |
| Alt text for images | <img alt="Description"> provides text alternatives. |
| Captioned media | The <track> element adds subtitles, captions and descriptions to video and audio. |
| ARIA attributes | role, aria-label, aria-describedby, aria-live enhance complex interactive widgets. |
| Keyboard navigation | All interactive elements must be keyboard-focusable (Tab / Enter / Space) with visible focus indicators. |
| Colour contrast | WCAG 2.1 requires 4.5:1 for normal text and 3:1 for large text. |
Activity — complete the code
Complete the code correctly to mark this lesson as complete automatically.
Complete the responsive page setup.
<meta name="" content="width=device-width, initial-scale=1">img {max-width: ;height: auto;}.grid {display: grid;grid-template-columns: repeat(, minmax(200px, 1fr));}