Article Heading
This is the main content of the article. Semantic HTML helps create a meaningful structure for your content.
Subsection
This is a subsection within the article.
Discover the modern web standard that revolutionized web development with new elements, APIs, and capabilities
Start LearningHTML5 is the fifth and current major version of HTML, the standard markup language for creating web pages and web applications. It was finalized in 2014 and represents a significant evolution from previous HTML standards.
HTML5 introduced numerous features that have become essential for modern web development.
Feature | Description |
---|---|
Semantic Elements | New elements like <header>, <footer>, <article>, and <section> that clearly define content structure |
Audio & Video | Native support for multimedia with <audio> and <video> elements |
Canvas | The <canvas> element for drawing graphics via JavaScript |
Geolocation | API for detecting user location |
Local Storage | Web storage for data persistence on the client side |
Form Enhancements | New form elements, attributes, and input types |
Drag & Drop | Native API for drag-and-drop functionality |
Web Workers | JavaScript running in the background without affecting page performance |
Semantic elements clearly define their meaning to both the browser and developer. They help create better document structure and improve accessibility.
Element | Description |
---|---|
<header> | Represents introductory content or a set of navigational links |
<nav> | Defines a set of navigation links |
<main> | Specifies the main content of a document |
<article> | Defines independent, self-contained content |
<section> | Defines a section in a document |
<aside> | Defines content aside from the content it is placed in |
<footer> | Defines a footer for a document or section |
<figure> & <figcaption> | Represents self-contained content with an optional caption |
<body> <header> <h1>Website Title</h1> <nav>...</nav> </header> <main> <article> <h2>Article Heading</h2> <p>Article content...</p> </article> <aside> <h3>Related Content</h3> <p>Sidebar content...</p> </aside> </main> <footer> <p>Copyright information</p> </footer> </body>
This is the main content of the article. Semantic HTML helps create a meaningful structure for your content.
This is a subsection within the article.
HTML5 introduced several new form input types and attributes to enhance user experience and validation.
Input Type | Description |
---|---|
For email addresses with validation | |
url | For web addresses with validation |
number | For numerical input with spinner controls |
range | Slider control for numerical input |
date | Date picker control |
time | Time input control |
color | Color picker control |
search | Search field with specialized styling |
Attribute | Description |
---|---|
placeholder | Hint text displayed in the input field when empty |
required | Specifies that an input field must be filled out |
autofocus | Automatically focuses the input element when page loads |
pattern | Regular expression pattern for input validation |
autocomplete | Controls browser autocomplete behavior |
<form> <div class="form-group"> <label for="email">Email:</label> <input type="email" id="email" required placeholder="Enter your email"> </div> <div class="form-group"> <label for="birthdate">Birth Date:</label> <input type="date" id="birthdate"> </div> <div class="form-group"> <label for="volume">Volume:</label> <input type="range" id="volume" min="0" max="100" step="5"> </div> <div class="form-group"> <label for="color">Favorite Color:</label> <input type="color" id="color" value="#ff0000"> </div> <button type="submit">Submit</button> </form>
HTML5 introduced several JavaScript APIs that extend the capabilities of web applications.
API | Description |
---|---|
Geolocation | Allows websites to detect the user's physical location |
Drag & Drop | Enables native drag-and-drop functionality |
Local Storage | Stores data in the user's browser with no expiration |
Session Storage | Stores data for one session (cleared when tab closes) |
Web Workers | Runs JavaScript in the background without blocking UI |
Web Sockets | Provides full-duplex communication channels over TCP |
Canvas | Provides a bitmap area for drawing with JavaScript |
// Check if Geolocation is supported if (navigator.geolocation) { // Get current position navigator.geolocation.getCurrentPosition( function(position) { // Success callback const lat = position.coords.latitude; const lng = position.coords.longitude; console.log(`Latitude: ${lat}, Longitude: ${lng}`); }, function(error) { // Error callback console.error("Error getting location:", error.message); } ); } else { console.log("Geolocation is not supported by this browser."); }
HTML5 was designed with backward compatibility in mind, allowing it to work in older browsers while providing enhanced features in modern browsers.
Modernizr is a JavaScript library that detects HTML5 and CSS3 features in the user's browser.
<script src="modernizr.js"></script> <script> if (Modernizr.geolocation) { // Use geolocation API } else { // Provide fallback solution } </script>
Create a blog post using HTML5 semantic elements and new features.
A showcase of modern web technologies
Published on
HTML5 has revolutionized web development by providing a rich set of features that enable developers to create more interactive and dynamic web applications.
With semantic elements like <article>, <section>, and <nav>, HTML5 makes it easier to create meaningful document structures.
Native <audio> and <video> elements eliminate the need for plugins like Flash.