HTML Flashcards
HTML interview questions
List some APIs available in HTML5.
HTML5 introduced several new APIs to enhance web application capabilities. Some notable APIs include Canvas API, Geolocation API, Web Storage API, Web Workers API, WebSockets API, File API, Drag and Drop API, and Audio/Video APIs.
What are some key page structure elements introduced by HTML5?
HTML5 introduced semantic elements for structuring web pages. Some include <header>, <nav>, <main>, <article>, <section>, <aside>, <footer>, <figure>, and <figcaption>.</figure>
What is the difference between HTML and HTML5?
HTML is the standard language for creating web pages, while HTML5 is its fifth version with enhanced features and capabilities. HTML5 introduced semantic elements, multimedia support, canvas and SVG graphics, improved forms, geolocation, web storage, offline support, and better APIs.
Are HTML5 tags case sensitive?
No, HTML5 tags are case-insensitive when rendering content in web browsers. The browser treats lowercase, uppercase, or mixed case tags the same way. However, it’s recommended to use lowercase for consistency and adherence to best practices.
Can a web page contain multiple <footer> elements?
Yes, a web page can have multiple <footer> elements. Each <footer> represents closing content at the bottom of a section and can be used in various sections of the page.
Can a web page contain multiple <header> elements?
Yes, a web page can have multiple <header> elements. Each <header> represents introductory content at the top of a section and can be used in different parts of the page.
How did HTML5 enhance form handling?
HTML5 introduced new input types like email, url, and date. It also included attributes like required and placeholder for improved form validation and user experience.
How do you choose between <svg> and <canvas>?</canvas></svg>
<svg> is best for resolution-independent graphics with styling and interaction needs. <canvas> is suited for pixel-based real-time graphics and animations. Selection depends on project requirements.
</canvas></svg>
How do you choose the right storage mechanism in HTML5?
Each mechanism has strengths. Local and Session Storage for small data. IndexedDB for large datasets. Cookies for specific data. Cache API for resource caching. Choose based on app needs.
How does HTML5 enhance multimedia support on the web?
HTML5 introduced native support for <audio> and <video> elements, eliminating the need for third-party plugins like Flash. This improves compatibility and performance for multimedia content.</video></audio>
How is local storage used in HTML5?
Local storage is accessed through JavaScript’s localStorage object. Data is stored using localStorage.setItem(key, value) and retrieved using localStorage.getItem(key). JSON methods are often used for working with complex data.
How is the Geolocation API used in HTML5?
The Geolocation API allows developers to request user permission for location access. Once granted, JavaScript can retrieve device coordinates for purposes like mapping, navigation, weather forecasts, and local search.
How many tags were removed in HTML5?
Tags like <font>, <center>, and <strike> were among the approximately 25 tags removed in HTML5. This removal aimed to encourage modern practices and separate content from presentation.</strike></center></font>
List key HTML5 page structure elements.
HTML5 introduced several semantic elements for better structuring:
<header>: Top of the page, often containing logo and navigation.
<nav>: Section for navigation links.
<main>: Main content area (one per page).
<article>: Self-contained content like blog posts.
<section>: Groups related content.
<aside>: Tangentially related content.
<footer>: Bottom of the page, with copyright and links.
<figure> & <figcaption>: Media with captions.
</figcaption></figure></footer></aside></section></article></main></nav></header>
List some APIs available in HTML5. (in detail)
Canvas API: For dynamic graphics and animations using <canvas> element.
Geolocation API: Access user's location for location-based services.
Web Storage API: Store data locally with localStorage and sessionStorage.
Web Workers API: Execute background JavaScript for multi-threading.
WebSockets API: Real-time communication between client and server.
File API: Access and manipulate files on the user's device.
Drag and Drop API: Enable user interface interactions.
Audio/Video APIs: Play and control multimedia content.</canvas>
What are Cookies in HTML5?
Cookies are small data pieces sent by servers and stored in browsers. They hold info like authentication tokens. They have size limits and are sent with each HTTP request.