Skip to main content
Practice Problems

Html5 new features and apis

What's New in HTML5?

HTML5 introduced major improvements to HTML, including new semantic elements, multimedia support, form enhancements, and powerful JavaScript APIs — eliminating the need for many third-party plugins.


New Semantic Elements

html
<header>Site header</header> <nav>Navigation</nav> <main>Main content</main> <article>Self-contained content</article> <section>Thematic grouping</section> <aside>Sidebar content</aside> <footer>Site footer</footer> <figure> <img src="photo.jpg" alt="A description"> <figcaption>Photo caption</figcaption> </figure> <details> <summary>Click to expand</summary> <p>Hidden content revealed on click</p> </details>

Native Multimedia

html
<!-- Video --> <video controls width="600"> <source src="movie.mp4" type="video/mp4"> <source src="movie.webm" type="video/webm"> Your browser does not support video. </video> <!-- Audio --> <audio controls> <source src="song.mp3" type="audio/mpeg"> </audio>

No need for Flash or other plugins.

New Form Input Types

html
<input type="email" placeholder="user@example.com"> <input type="url" placeholder="https://..."> <input type="tel" placeholder="+380..."> <input type="number" min="0" max="100" step="5"> <input type="range" min="0" max="100"> <input type="date"> <input type="time"> <input type="color"> <input type="search">

New Form Attributes

html
<input type="text" required placeholder="Name" autofocus> <input type="email" pattern="[a-z]+@[a-z]+\.[a-z]+" autocomplete="email"> <form novalidate>...</form>

New JavaScript APIs

APIDescription
Canvas API2D drawing via <canvas> element
GeolocationGet user's geographic location
Web StoragelocalStorage and sessionStorage
Web WorkersRun scripts in background threads
WebSocketFull-duplex communication with servers
Drag and DropNative drag-and-drop functionality
History APIManipulate browser history (pushState, replaceState)
Fetch APIModern replacement for XMLHttpRequest
Intersection ObserverDetect element visibility in viewport
Service WorkersOffline support and background sync

Canvas vs SVG

FeatureCanvasSVG
TypeRaster (pixel-based)Vector (shape-based)
ScalabilityLoses quality on zoomScales perfectly
DOM accessNo (just pixels)Yes (each shape is a DOM node)
Best forGames, image editing, data visualizationIcons, logos, illustrations, charts
Event handlingManual (coordinate-based)Built-in (per element)

Important:

HTML5 isn't just about new tags — it's a platform with powerful APIs. The semantic elements improve accessibility and SEO, while the JavaScript APIs enable rich web applications without plugins.

Short Answer

Interview ready
Premium

A concise answer to help you respond confidently on this topic during an interview.

Finished reading?
Practice Problems