HTML5 is the fifth and most recent version of the HTML (Hypertext Markup Language), which is the standard language used to create and structure content on the web. HTML5 was finalized by the World Wide Web Consortium (W3C) and the Web Hypertext Application Technology Working Group (WHATWG), and it represents a significant evolution from previous versions of HTML.
HTML5 provides new features and elements to improve the structure, functionality, and performance of web applications. It emphasizes support for multimedia, mobile devices, and better user interaction, making it an essential tool for modern web development.
Semantics:
Multimedia Support: HTML5 introduces native support for multimedia elements such as audio and video, without requiring third-party plugins like Flash or Silverlight. This improvement allows for seamless integration of rich media content in web applications.
<audio> element provides built-in controls for play, pause, volume, etc.
<audio controls>
<source src="audiofile.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
<video width="320" height="240" controls>
<source src="movie.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
Canvas for Drawing and Graphics:
<canvas id="myCanvas" width="500" height="500"></canvas>
<script>
var ctx = document.getElementById('myCanvas').getContext('2d');
ctx.fillStyle = "blue";
ctx.fillRect(20, 20, 150, 100);
</script>
Geolocation API:
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(position) {
var lat = position.coords.latitude;
var lon = position.coords.longitude;
alert("Latitude: " + lat + "\nLongitude: " + lon);
});
} else {
alert("Geolocation is not supported by this browser.");
}
Offline Web Applications:
Local Storage and Session Storage:
// Local Storage example
localStorage.setItem("username", "JohnDoe");
var username = localStorage.getItem("username");
Form Improvements: HTML5 introduced several new form controls and input types, making forms more interactive and easier to use:
Web Workers:
var worker = new Worker('worker.js');
worker.postMessage('start');
worker.onmessage = function(event) {
console.log('Message from worker:', event.data);
};
WebSockets:
var socket = new WebSocket('ws://example.com/socket');
socket.onopen = function() {
socket.send('Hello, server!');
};
socket.onmessage = function(event) {
console.log('Message from server:', event.data);
};
SVG and MathML:
<svg width="100" height="100">
<circle cx="50" cy="50" r="40" stroke="black" stroke-width="3" fill="red" />
</svg>
Rich User Experience:
Mobile-Friendly:
Standardized Web Development:
Improved Performance:
HTML5 is the backbone of modern web development, offering new features and improvements that make it easier for developers to create interactive, multimedia-rich, and mobile-friendly websites and applications. It provides powerful tools for handling multimedia, offline data storage, geolocation, and real-time communication, while also improving document semantics, accessibility, and performance. HTML5's wide adoption has made it the standard for building modern web experiences, and its features continue to evolve as web development progresses.
Open this section to load past papers