HTML5
HTML5
Introduction
New Features
1. Semantic Elements: New tags like <header>, <footer>, <article>, <section>, and
<nav> make the structure of web pages more meaningful.
2. Multimedia Support: The <audio> and <video> tags allow embedding of media directly
into web pages without additional plugins.
3. Canvas and SVG: The <canvas> element and Scalable Vector Graphics (SVG) enable
drawing and animations on the web.
4. Form Enhancements: HTML5 introduces new input types such as email, date, and
range, and attributes like placeholder and required to simplify form validation.
5. Geolocation API: Allows web applications to access the user’s location with permission.
6. Offline Storage: Features like Web Storage (localStorage and sessionStorage) and
App Cache enhance offline capabilities.
7. Responsive Design Support: New features work seamlessly with CSS3 to build responsive
and mobile-friendly websites.
Standard Attributes
Standard attributes in HTML5 are universal attributes that can be applied to most
elements. Some common ones include:
Custom Attributes
HTML5 allows developers to create custom attributes using the data-* format. These
attributes store extra data in an element that can be accessed via JavaScript. For
example:
Custom attributes are commonly used for dynamic content, configuration settings, or
metadata in web applications. They enhance flexibility while keeping the HTML code
clean and organized.
Inserting Images
The <img> tag in HTML5 is used to embed images into a webpage. Key attributes
include:
Example:
HTML5 simplifies embedding multimedia with the <audio> and <video> tags. These
tags eliminate the need for third-party plugins and support multiple file formats like
MP3, MP4, and WebM.
Audio Example:
<audio controls>
<source src="song.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
Video Example: