Chapter 1 deck Chapter 2 deck Chapter 3 deck Chapter 4 deck Chapter 5 deck Chapter 6 deck Chapter 7 deck Chapter 8 deck Chapter 9 deck Chapter 10 deck Chapter 11 deck Chapter 12 deck Chapter 13 deck Chapter 14 deck

Chapter 4: HTML5 & Modern Web Development

69 slides · use ←/→ or Space to navigate, F for fullscreen.

Reading view

Jump to a lesson deck: What is HTML5? History & Goals HTML4 vs HTML5: Doctype & Page Structure HTML5 Semantic & Markup Elements Native Media & Embedding Video Canvas & SVG Graphics HTML5 Forms & New Input Types CSS3 Effects & Improved Selectors Web Storage: localStorage & sessionStorage Geolocation & Web Workers Offline Apps & Drag-and-Drop Advantages of HTML5 & CSS3 HTML5 APIs, Responsive Design & Accessibility Chapter 4 Key Takeaways

Chapter 4: HTML5 & Modern Web Development
Fullscreen for presentation · Print / PDF for a handout
1 / 69
Chapter 4

Chapter 4: HTML5 & Modern Web Development

Semantic HTML5, native media, Canvas & SVG, forms, CSS3 effects, Web Storage, Geolocation, Web Workers, offline apps and drag & drop.

Lesson

What is HTML5? History & Goals

HTML5 as a complete platform, where it came from, and the goals that shaped it.

What is HTML5? History & Goals

What is HTML5?

HTML5 is not just a markup language — it is a complete platform for the modern web, made of three layers working together.

LayerRole
HTML5 — structure & markupNew semantic elements, forms and accessibility improvements
CSS3 — presentation & styleAnimations, gradients, flex/grid layout, custom fonts
JavaScript — behaviour & APIsDOM, Ajax, Canvas, Web Storage, Geolocation, Workers

HTML5 = HTML5 markup + CSS3 + JavaScript APIs.

What is HTML5? History & Goals

History of HTML

YearVersionMilestone
1991HTML 1.0Tim Berners-Lee's first specification
1995HTML 2.0First formal standard
1997HTML 3.2Tables, scripting, CSS
1997–98HTML 4.01 / XHTML 1.0Widely adopted
2008HTML5 draftW3C working draft published; WHATWG formed
2014HTML5Official W3C Recommendation
What is HTML5? History & Goals

Goals of HTML5

GoalMeaning
Backward compatibleAll existing web pages continue to work — no need to rewrite legacy sites.
Reduce plugin dependencyBuilt-in audio, video and canvas eliminate reliance on Flash and Java applets.
Semantic clarityNew elements communicate meaning and structure to browsers and developers.
Device independenceWeb content renders consistently across desktops, tablets and phones.
Robust error handlingBrowsers parse and display malformed markup gracefully and consistently.
What is HTML5? History & Goals

Activity — complete the code

Complete the HTML5 document head.

html>
<html lang="en">
<head>
<meta ="UTF-8">
<meta name="viewport" content="width=, initial-scale=1">
<title>HTML5</title>
</head>
<body>
<h1>Hello HTML5</h1>
</body>
</html>

Lesson

HTML4 vs HTML5: Doctype & Page Structure

What changed from HTML4/XHTML, the simplified doctype, and the new page skeleton.

HTML4 vs HTML5: Doctype & Page Structure

HTML4 vs HTML5 — Key Differences

FeatureHTML 4HTML 5
StructureGeneric <div> containersSemantic tags: <header>, <nav>, <article>, <section>, <aside>, <footer>
MediaRequires Flash / plug-insNative <audio> & <video> elements
SyntaxCannot handle inaccurate codeTolerant parser, graceful degradation
APIsTraditional DOM APIs onlyCanvas, Drag & Drop, Geolocation, Workers
Local storageCookies only (~4 KB)localStorage / sessionStorage (5 MB+)
FormsBasic input typesdate, email, url, range, color, and more
HTML4 vs HTML5: Doctype & Page Structure

Document Type Declarations

HTML 4.01 and XHTML required long, version-specific doctypes. HTML5 simplified it dramatically:

<!DOCTYPE html>

Easy to memorise, and version-independent — the same doctype works for the living standard.

HTML4 vs HTML5: Doctype & Page Structure

HTML5 Page Structure

The old way relied on generic containers with IDs:

<div id="header">...</div>
<div id="nav">...</div>
<div id="section">...</div>
<div id="aside">...</div>
<div id="footer">...</div>

HTML5 replaces them with meaningful elements:

<header>...</header>
<nav>...</nav>
<section>...</section>
<article>...</article>
<aside>...</aside>
<footer>...</footer>
HTML4 vs HTML5: Doctype & Page Structure

Activity — complete the code

Replace the old HTML4 containers with HTML5 equivalents.

<!-- Old HTML4 -->
<div id="header">...</div>
 
<!-- HTML5 -->
<>...</header>
 
<!-- Old HTML4 -->
<div id="footer">...</div>
 
<!-- HTML5 -->
<>...</footer>
 
<!-- Doctype -->
html>

Lesson

HTML5 Semantic & Markup Elements

The new elements that describe meaning, and the complete markup reference.

HTML5 Semantic & Markup Elements

HTML5 Semantic Elements

Semantic elements describe meaning to both the browser and the developer.

ElementMeaning
<header>Introductory content, logos, navigation
<nav>Primary navigation links
<main>Dominant content of the document
<article>Self-contained, independent content
<section>Thematic grouping of content
<aside>Tangentially related content (sidebars)
<footer>Footer for the nearest section or the document
<figure> / <figcaption>Self-contained illustration or media, with a caption
<time>Machine-readable date or time (ISO 8601)
<mark>Highlighted / search-relevant text
<details> / <summary>Disclosure widget with a visible label
HTML5 Semantic & Markup Elements

Markup Elements Reference

ElementPurpose
<figure>Independent, self-contained content (image, code, diagram) with optional caption
<progress>Task completion indicator (loading, processing)
<meter>Scalar measurement within a known range (disk space, score)
<details> / <summary>Disclosure widget hidden until toggled; summary is the visible label
<aside>Content related but aside from the main content (sidebars, pull quotes)
<figcaption>Caption or legend for the parent <figure>
<time>Machine-readable date/time using ISO 8601
HTML5 Semantic & Markup Elements

New Elements at a Glance

<figure>, <figcaption>, <svg>, <footer>, <progress>, <header>, <section>, <video>, <hgroup>, <details>.

HTML5 Semantic & Markup Elements

Activity — complete the code

Complete the semantic markup elements.

<figure>
<img src="chart.png" alt="Sales chart">
<>Sales chart</figcaption>
</figure>
 
<>
<summary>Click to expand</summary>
<p>Hidden content.</p>
</details>
 
<progress value="70" ="100"></progress>

Lesson

Native Media & Embedding Video

audio, video, source and track — plus embedding YouTube with iframes.

Native Media & Embedding Video

HTML5 Media Elements

ElementPurpose
<audio>Embeds audio with native browser controls. Supports MP3, OGG, WAV. No Flash required.
<video>Embeds video. Supports MP4, WebM, OGG. Attributes: controls, autoplay, loop, muted.
<source>Specifies multiple media resources so the browser picks its best-supported format.
<track>Adds timed text tracks (subtitles, captions, chapters) to video and audio.
<embed>Container for external applications or plug-ins (legacy) — prefer audio/video.
Native Media & Embedding Video

Video Example

<video width="640" height="368" controls poster="thumb.jpg">
  <source src="movie.mp4" type="video/mp4">
  <source src="movie.webm" type="video/webm">
  Your browser does not support the video tag.
</video>
Native Media & Embedding Video

Audio Example

<audio controls>
  <source src="music.mp3" type="audio/mpeg">
  <source src="music.ogg" type="audio/ogg">
  Your browser does not support the audio element.
</audio>

Use multiple <source> elements to ensure cross-browser compatibility.

Native Media & Embedding Video

Embedding YouTube Videos

  1. Upload your video to YouTube and obtain its video ID from the URL.
  2. Use an <iframe> element — not the older <embed> or <object> tags.
  3. Set the src to https://www.youtube.com/embed/{VIDEO_ID}.
  4. Control dimensions with width and height attributes.
  5. Add parameters for autoplay, loop, controls, etc.
<!-- Basic YouTube embed -->
<iframe
  src="https://www.youtube.com/embed/VIDEO_ID"
  width="560" height="315"
  title="YouTube video"
  allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
  allowfullscreen>
</iframe>
Native Media & Embedding Video

Activity — complete the code

Complete the native video element.

<video width="640" height="368" poster="thumb.jpg">
<source src="movie.mp4" type="">
<source src="movie.webm" type="video/webm">
< src="subs.vtt" kind="captions" default>
Your browser does not support the video tag.
</video>

Lesson

Canvas & SVG Graphics

Bitmap drawing with Canvas, scalable vector graphics with SVG, and when to use each.

Canvas & SVG Graphics

The HTML5 Canvas Element

The <canvas> element provides a resolution-dependent bitmap surface for JavaScript-driven drawing.

<canvas id="myCanvas" width="400" height="300"></canvas>
const canvas = document.getElementById("myCanvas");
const ctx = canvas.getContext("2d");

// Draw a red rectangle
ctx.fillStyle = "rgb(200, 0, 0)";
ctx.fillRect(10, 10, 120, 90);

// Draw a blue rectangle (overlapping)
ctx.fillStyle = "rgba(0, 0, 200, 0.6)";
ctx.fillRect(60, 55, 120, 90);

// Draw a circle
ctx.beginPath();
ctx.arc(250, 150, 60, 0, Math.PI * 2);
ctx.fillStyle = "#0891B2";
ctx.fill();

Canvas capabilities

  • Draw shapes, paths and gradients
  • Render and manipulate images
  • Animate using requestAnimationFrame
  • Capture user events (click, drag)
  • Export the result as PNG or JPEG

Canvas is raster-based — quality degrades when scaled.

Canvas & SVG Graphics

Scalable Vector Graphics (SVG)

Inline SVG in HTML5:

<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200">
  <circle cx="60" cy="60" r="40" fill="#0891B2" />
  <rect x="100" y="20" width="80" height="80" fill="#7C3AED" />
  <text x="20" y="160" font-size="18">SVG</text>
</svg>

SVG key properties

  • Resolution independent — scales perfectly at any size
  • Supports event handlers (onclick, onmouseover)
  • Part of the DOM — style with CSS, script with JS
  • Ideal for icons, charts, maps and illustrations
  • Each shape is a separate DOM element
  • Accessible — add title, desc and ARIA attributes
Canvas & SVG Graphics

Canvas vs SVG — When to Use Which?

CriterionCanvasSVG
TypeRaster (pixel-based)Vector (coordinate-based)
ResolutionDependent — blurs when scaledIndependent — crisp at any size
Event handlingNot built-in (manual hit-testing)Native (each shape is a DOM node)
PerformanceFast for many pixels / framesSlower with many DOM elements
Best use casesGames, photo editing, animationCharts, maps, icons, diagrams
AccessibilityLimited without extra workFull ARIA / semantic support
ExportPNG / JPEG snapshotXML file, scalable, editable
Canvas & SVG Graphics

Activity — complete the code

Complete the canvas drawing code and the SVG shape.

<canvas id="art" width="400" height="300"></canvas>
<script>
const ctx = document.getElementById("art").("2d");
ctx. = "#2563eb";
ctx.fillRect(10, 10, 120, 90);
</script>
 
<svg xmlns="http://www.w3.org/2000/svg">
< cx="60" cy="60" r="40" fill="teal" />
</svg>

Lesson

HTML5 Forms & New Input Types

Enhanced inputs, validation attributes and new form elements.

HTML5 Forms & New Input Types

New HTML5 Input Types

TypePurpose
emailAuto-validates email format
urlValidates URL format
numberSpinner control with min / max / step
rangeSlider control
dateNative date picker
timeNative time picker
datetime-localDate + time combined
month / weekMonth / week selector
searchClear button on supported browsers
colorColour picker widget
telOpens numeric keypad on mobile
HTML5 Forms & New Input Types

HTML5 Form Enhancements

<!-- Placeholder text -->
<input type="text" placeholder="Your name">

<!-- Pattern validation -->
<input type="text" pattern="[0-9]{5}" title="5 digits">

<!-- Required field -->
<input type="email" required>

<!-- Autocomplete -->
<input type="text" autocomplete="name">
HTML5 Forms & New Input Types

Datalist (Suggestions)

<input list="courses" name="course">
<datalist id="courses">
  <option value="HTML">
  <option value="CSS">
  <option value="JavaScript">
</datalist>

Provides a list of pre-defined options for an <input> — like an autocomplete suggestion box.

HTML5 Forms & New Input Types

Output, Progress & Meter

<input type="range" id="r" value="0"
       oninput="o.value = r.value">
<output id="o" for="r">0</output>

<progress value="70" max="100">70%</progress>
<meter value="75" min="0" max="100">75%</meter>
ElementPurpose
<output>Represents the result of a calculation or user interaction — ideal for live form computations.
<progress>Displays a progress bar indicating how much of a task has been completed.
<meter>Represents a scalar measurement within a known range — disk usage, score, relevance.
HTML5 Forms & New Input Types

Activity — complete the code

Complete the HTML5 form with new input types and elements.

<form>
<input type="" placeholder="you@example.com">
<input type="" name="age" min="1" max="120">
<input ="courses" name="course">
<datalist id="courses">
<option value="HTML">
<option value="CSS">
</datalist>
< value="70" max="100"></progress>
</form>

Lesson

CSS3 Effects & Improved Selectors

Rounded corners, shadows, gradients, transforms and the new CSS3 selectors.

CSS3 Effects & Improved Selectors

CSS3 Key Features

FeatureExample
Rounded cornersborder-radius: 12px;
Box shadowbox-shadow: 4px 4px 12px rgba(0,0,0,.25);
Gradientsbackground: linear-gradient(135deg, #0891B2, #7C3AED);
Text shadowtext-shadow: 2px 2px 4px rgba(0,0,0,.35);
Opacity / RGBAbackground-color: rgba(8,145,178,.6);
Transformstransform: rotate(45deg) scale(1.2);
Multiple columnscolumn-count: 3; column-gap: 1.5rem;
Transitions & animationtransition: all .3s ease-in-out;
CSS3 Effects & Improved Selectors

CSS3 in Practice — Code Example

.card {
  padding: 2rem;
  width: 300px;

  /* Rounded corners */
  border-radius: 16px;

  /* Gradient background */
  background: linear-gradient(135deg, #0891B2, #7C3AED);

  /* Shadow */
  box-shadow: 0 8px 24px rgba(0, 0, 0, .25);

  /* Transition for hover effect */
  transition: transform .3s ease, box-shadow .3s ease;
}

.card:hover {
  transform: translateY(-6px) scale(1.02);
  box-shadow: 0 16px 40px rgba(0, 0, 0, .35);
}
  • border-radius creates rounded corners without images.
  • linear-gradient replaces gradient images.
  • box-shadow eliminates the need for shadow images.
  • transition animates property changes smoothly.
  • transform allows 2D/3D manipulation.

Vendor prefixes are rarely needed in modern browsers.

CSS3 Effects & Improved Selectors

CSS3 Improved Selectors

SelectorMatches
[attr^="value"]Attribute starts-with — e.g. links starting with https
[attr$="value"]Attribute ends-with — e.g. images ending in .png
[attr*="value"]Attribute contains — flexible substring matching
:nth-child(n)Select by position — e.g. every 2nd row in a table
:first-child / :last-childFirst / last child of its parent
:checkedChecked checkbox/radio inputs
:not(selector)All elements that do NOT match the given selector
:focus-visibleShow the focus ring only for keyboard users — improves UX
CSS3 Effects & Improved Selectors

Activity — complete the code

Complete the CSS3 card effect.

.card {
border-radius: ;
background: -gradient(135deg, #0891B2, #7C3AED);
box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
transition: transform .3s ease;
}
 
.card:hover {
transform: translateY(-6px) (1.02);
}

Lesson

Web Storage: localStorage & sessionStorage

Client-side storage APIs, code examples, and how they compare with cookies and IndexedDB.

Web Storage: localStorage & sessionStorage

The Web Storage API

Before HTML5, cookies (~4 KB) were the only client-side storage option — limited, insecure, and sent with every request.

localStoragesessionStorage
Persistent — survives browser close/reopen
Scoped per origin (domain + protocol + port)
~5 MB per origin (browser-dependent)
JavaScript key-value API: setItem / getItem
NOT sent to server — stays in the browser
Use for preferences, cached data, offline content
Session-scoped — cleared when the tab/window closes
Each tab has its own independent storage
Same ~5 MB size limit
Identical API to localStorage
Use for per-session state: forms, wizard steps
More private — not shared between tabs
Web Storage: localStorage & sessionStorage

Web Storage — Code Examples

// localStorage
if (typeof Storage !== "undefined") {
  // Store a string value
  localStorage.setItem("username", "Alice");

  // Store an object (serialize to JSON)
  const prefs = { theme: "dark", lang: "en" };
  localStorage.setItem("prefs", JSON.stringify(prefs));

  // Retrieve and parse
  const saved = JSON.parse(localStorage.getItem("prefs"));
  console.log(saved.theme); // "dark"

  // Remove one key / clear everything
  localStorage.removeItem("username");
  localStorage.clear();
}

// sessionStorage
sessionStorage.setItem("step", "2");
const step = sessionStorage.getItem("step"); // "2"

// Iterate all keys
for (let i = 0; i < sessionStorage.length; i++) {
  const key = sessionStorage.key(i);
  console.log(key, sessionStorage.getItem(key));
}
Web Storage: localStorage & sessionStorage

Storage Options Comparison

Size limitSent to serverData typesBest for
Cookie~4 KBYes (every request)Strings onlyAuth tokens
localStorage~5 MB+NoStrings onlyPreferences / cache
sessionStorage~5 MB+NoStrings onlyPer-session state
IndexedDBHundreds of MB+NoAny JS objectLarge / complex data
Web Storage: localStorage & sessionStorage

Activity — complete the code

Complete the Web Storage code.

// Save a value
localStorage.("username", "Alice");
 
// Read a value
const name = localStorage.("username");
 
// sessionStorage is cleared when the closes.

Lesson

Geolocation & Web Workers

Location-aware apps with explicit permission, and background threads for heavy computation.

Geolocation & Web Workers

HTML5 Geolocation API

Geolocation lets a web application access the user's physical location — with explicit permission.

// Check if geolocation is supported
if ("geolocation" in navigator) {
  // Get current position (one-time)
  navigator.geolocation.getCurrentPosition(
    (position) => {
      const lat = position.coords.latitude;
      const lon = position.coords.longitude;
      const acc = position.coords.accuracy; // meters
      console.log(`Lat: ${lat}, Lon: ${lon}, Accuracy: ${acc}m`);
    },
    (error) => console.error("Error: ", error.message),
    { enableHighAccuracy: true, timeout: 5000 }
  );

  // Watch position changes (continuous)
  const watchId = navigator.geolocation.watchPosition(callback);

  // Stop watching
  navigator.geolocation.clearWatch(watchId);
}

Methods

  • getCurrentPosition() — retrieves the position once
  • watchPosition() — continuously monitors position
  • clearWatch(id) — stops watching

Location sources

IP address, Wi-Fi triangulation, cell tower data and GPS (device hardware).

Geolocation & Web Workers

Geolocation: Privacy & Best Practices

  • User consent required — the browser always prompts before sharing location; no data is transmitted without explicit permission.
  • Accuracy varies — IP address is city-level (~10 m), Wi-Fi is more precise, GPS is most accurate.
  • HTTPS required — modern browsers block geolocation over HTTP. Always deploy with TLS/HTTPS.
  • Respect the user — cache location when appropriate and don't call watchPosition() unnecessarily (it drains battery).
Geolocation & Web Workers

Web Workers — Background Threads

JavaScript is single-threaded by design. Web Workers add true background execution so heavy tasks don't freeze the UI.

// main.js
const worker = new Worker("worker.js");
worker.postMessage({ data: bigArray });
worker.onmessage = (e) => {
  console.log("Result:", e.data);
};
// worker.js
self.onmessage = (e) => {
  const result = heavyComputation(e.data);
  self.postMessage(result);
};
  • CPU-intensive tasks don't freeze the UI.
  • Multiple workers can run in parallel.
  • Communicate via postMessage() / onmessage.
  • No access to the DOM (runs in a separate scope).
Geolocation & Web Workers

Activity — complete the code

Complete the Geolocation call and the Web Worker.

if ("geolocation" in navigator) {
navigator.geolocation.((position) => {
console.log(position.coords.latitude);
});
}
 
// Background thread
const worker = new ("worker.js");
worker.({ data: bigArray });

Lesson

Offline Apps & Drag-and-Drop

Cache manifests for offline use and the native Drag & Drop API.

Offline Apps & Drag-and-Drop

HTML5 Offline Applications

HTML5 supports local caching of web app code and content, enabling use without an internet connection. A cache manifest lists what to store.

CACHE MANIFEST
# Version 1.0.2

CACHE:
index.html
styles/app.css
scripts/app.js
images/logo.png

NETWORK:
api/login.php

FALLBACK:
/app/ /offline.html
SectionMeaning
CACHEFiles listed here are downloaded once and served from the local cache thereafter.
NETWORKFiles in this section always require a network connection — never cached.
FALLBACKSpecifies a fallback page to serve when a network resource is unavailable.

Modern practice replaces App Cache with Service Workers, which give finer control over offline caching.

Offline Apps & Drag-and-Drop

HTML5 Drag and Drop API

<div id="item" draggable="true">Drag me!</div>
<div id="zone">Drop here</div>
const item = document.getElementById("item");
const zone = document.getElementById("zone");

// Events on the draggable element
item.addEventListener("dragstart", (e) => {
  e.dataTransfer.setData("text/plain", e.target.id);
  e.target.style.opacity = "0.5";
});
item.addEventListener("dragend", (e) => {
  e.target.style.opacity = "1";
});

// Events on the drop target
zone.addEventListener("dragover", (e) => {
  e.preventDefault(); // allow the drop
});
zone.addEventListener("drop", (e) => {
  e.preventDefault();
  const id = e.dataTransfer.getData("text/plain");
  zone.appendChild(document.getElementById(id));
});
EventFires when
dragstartDragging begins
dragContinuously while dragging
dragendThe drag operation ends
dragenterA dragged item enters a target
dragoverDragging over a target
dragleaveThe item leaves a target
dropThe item is released on a target
Offline Apps & Drag-and-Drop

Activity — complete the code

Complete the Drag and Drop handlers.

<div id="item" ="true">Drag me!</div>
 
zone.addEventListener("", (e) => {
e.preventDefault();
});
 
zone.addEventListener("drop", (e) => {
const id = e..getData("text/plain");
});

Lesson

Advantages of HTML5 & CSS3

Multi-platform reach, SEO, offline capability, browser consistency and the standards timeline.

Advantages of HTML5 & CSS3

Cost-Effective Multi-Platform Development

  • Write once, deploy everywhere — HTML5 code runs on desktops, tablets, phones and smart TVs.
  • Lower costs — one codebase serves all platforms, reducing development, testing and maintenance effort.
  • Hybrid apps — combine web standards inside a native wrapper to publish to app stores.
  • iOS & Android — the recommended approach for cross-platform mobile; frameworks like Cordova/Capacitor wrap it natively.
  • Code reuse — shared templates, CSS and JavaScript across desktop and mobile sites.
Advantages of HTML5 & CSS3

HTML5 & Search Engine Optimisation (SEO)

FactorBenefit
Semantic structureSearch engines read <article>, <nav>, <main> to understand page structure — improving index quality.
Logical hierarchyA clean heading hierarchy (h1 → h2 → h3) signals document meaning to bots and screen readers.
Native videoHTML5 video is indexable by search engines — unlike Flash content.
PerformanceOffline cache, local storage and reduced plugin overhead speed up page load — a key ranking signal.
MicrodataStructured data (Schema.org) enables Google Rich Snippets: stars, prices, events.
Advantages of HTML5 & CSS3

Offline Browsing — A Business Advantage

  • Publishers & news — readers access articles downloaded while online, continuing offline on public transport or in poor signal areas.
  • Enterprise apps — field workers use web-based tools in remote locations, syncing when connectivity returns.
  • Performance boost — cached assets (CSS, JS, images) are served instantly from local storage rather than the network.
  • User retention — apps that work offline are perceived as more reliable and professional.
Advantages of HTML5 & CSS3

Consistency Across Browsers & Devices

HTML5 and CSS3 target a consistent rendering model, reducing the "works in Chrome, breaks in Firefox" problem. Modern browsers score 85–95% of the HTML5 specification.

BrowserHTML5 test score (/555)
Chrome528
Opera518
Edge492
Firefox491
Safari471
Advantages of HTML5 & CSS3

Business Intelligence & Native Video

  • HTML5-compatible devices share a consistent data collection and analytics layer.
  • Standard browser APIs (Fetch, WebSockets) enable real-time dashboards.
  • Native video plays on all devices — including iOS — without Flash or Silverlight, and positively impacts SEO.
  • Accessible, standards-compliant HTML5 sites reach a wider audience, including assistive-technology users.
Advantages of HTML5 & CSS3

Web Standards Evolution

EraHTMLCSSJavaScript
1991–96HTML 1–2CSS 1–2—
1997–98HTML 3.2–4.0CSS 2.1JS / ECMA
2003–08HTML 4.01 / XHTML 1CSS 2.1DOM 2, Ajax
2009–14XHTML 2 (abandoned), HTML5 draftCSS 3 modulesDOM APIs
2014–22HTML5 RecommendationCSS 3 modulesES6+, Fetch
Advantages of HTML5 & CSS3

Activity — complete the code

Complete the SEO-friendly semantic markup and native video.

<!-- SEO-friendly semantic structure -->
<>
<>Article content</article>
</main>
 
<!-- Native video (indexable, no Flash) -->
<video >
<source src="promo.mp4" type="">
</video>

Lesson

HTML5 APIs, Responsive Design & Accessibility

The full API picture, responsive techniques, and making HTML5 accessible.

HTML5 APIs, Responsive Design & Accessibility

HTML5 APIs — The Full Picture

APIPurpose
Canvas 2D APIDraw shapes, text and images via JavaScript
Web Workers APIBackground threads for heavy computation
History APIManipulate browser history without a page reload
Fetch APIModern replacement for XMLHttpRequest
Web Storage APIlocalStorage and sessionStorage
Drag & Drop APINative drag-and-drop interactions
Notifications APIDisplay native desktop notifications
Fullscreen APIRequest fullscreen for any element
GeolocationAccess user location with permission
File APIRead local files in the browser
WebSocket APIFull-duplex real-time communication
Server-Sent EventsPush data from server to browser
HTML5 APIs, Responsive Design & Accessibility

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 APIs, Responsive Design & Accessibility

HTML5 & Web Accessibility

PracticeDetail
Semantic HTML5 elementsScreen readers understand <nav>, <main>, <article> — no extra ARIA needed for basic structure.
Alt text for images<img alt="Description"> provides text alternatives.
Captioned mediaThe <track> element adds subtitles, captions and descriptions to video and audio.
ARIA attributesrole, aria-label, aria-describedby, aria-live enhance complex interactive widgets.
Keyboard navigationAll interactive elements must be keyboard-focusable (Tab / Enter / Space) with visible focus indicators.
Colour contrastWCAG 2.1 requires 4.5:1 for normal text and 3:1 for large text.
HTML5 APIs, Responsive Design & Accessibility

Activity — complete the code

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));
}

Lesson

Chapter 4 Key Takeaways

Everything you need to remember about HTML5.

Chapter 4 Key Takeaways

Key Takeaways

#Takeaway
1HTML5 = HTML + CSS3 + JS APIs — it's a complete platform, not just a markup language.
2Semantic elements — <header>, <nav>, <article>, <section> improve structure, SEO and accessibility.
3Native media — <audio> and <video> eliminate Flash dependency; built-in, cross-browser, mobile-ready.
4Powerful APIs — Canvas, Geolocation, Web Storage, Workers, Drag & Drop — all without plugins.
5CSS3 effects — gradients, shadows, animations, transforms, flexbox & grid — pure CSS, no images.
6Offline & storage — app cache and localStorage enable offline-capable web apps with persistent data.
Chapter 4 Key Takeaways

Further Reading

  • MDN Web Docs — developer.mozilla.org
  • HTML5 Specification — html.spec.whatwg.org
  • W3Schools HTML5 — w3schools.com/html
  • Can I use — caniuse.com
Chapter 4 Key Takeaways

Activity — complete the code

Complete the HTML5 recap.

HTML5 = HTML + CSS3 + APIs
Semantic elements: <header>, <nav>, <>, <section>
Native media: <> and <video>
APIs: Canvas, Geolocation, Web Storage,