HTML5, the fifth version of the HyperText Markup Language (HTML), introduced several new features and improvements over its previous version, HTML4.
1. Semantic Elements: HTML5 introduced elements like <article>
, <section>
, <nav>
, <header>
, and <footer>
. These provide a clearer structure, making it easier to understand the role of different parts of a webpage. This not only aids in readability but also benefits SEO and accessibility.
2. Video and Audio Support: Before HTML5, embedding audio and video in web pages usually required third-party plugins. HTML5 introduced the <audio>
and <video>
elements, allowing for native media playback. It’s akin to having a built-in media player in your web page.
3. Web Storage: HTML5 introduced two important storage options: localStorage
and sessionStorage
. These allow websites to store data on the client’s browser in a more secure and efficient way than the older cookies method.
4. New Form Attributes: HTML5 introduced new form attributes like required
, placeholder
, disabled
, and readonly
. These attributes help make forms more accessible and user-friendly.
And also introduced new input type attributes like date
, time
, week
, month
, number
, email
,, tel
, color
, and password
.
5. New Global Attributes: HTML5 introduced several new global attributes like contenteditable
, spellcheck
, and data-*
(for custom data attributes). These provide more control and flexibility over the behavior of HTML elements.
6. Geolocation API: This allows websites to access the geographical location of the user. Think of how many apps now suggest restaurants or shops near you; that’s often powered by this feature.
These new features make HTML5 a more comprehensive and powerful language than HTML4.