HTML5 Interviews – Top Questions & Answers for Web Developers
Answer: HTML5 is the latest version of HyperText Markup Language used for structuring and presenting content on the World Wide Web.
Answer:
New semantic elements include <header>, <footer>, <article>, <section>, <nav>, <aside>, <main>, <figure>, <figcaption>, <time>, <mark>, and <progress>.
Answer:
The <canvas> element is used for drawing graphics, animations, or other visual images on the fly via JavaScript.
Answer:
<div> is a generic container for styling and scripting, while <section> is a semantic element that represents a thematic grouping of content.
Answer:
The <article> tag represents a self-contained composition in a document, page, or site that is independently distributable or reusable.
Answer:
The <audio> tag is used to embed sound content in web pages.
Answer:
The <video> tag is used to embed video content in web pages.
Answer: HTML5 introduces new elements, attributes, and APIs for multimedia, graphics, and improved semantics, while older HTML versions lack these features.
Answer:
<figure> is used for illustrations, diagrams, photos, code listings, etc., and <figcaption> provides a caption for the <figure> content.
Answer:
The <nav> element is used to define a set of navigation links.
Answer:
Use the <meta name="viewport" content="width=device-width, initial-scale=1.0"> tag and CSS media queries.
Answer:
The <header> element represents introductory content or a set of navigational aids.
Answer:
The <footer> element represents the footer of a section or page, typically containing copyright info, contact details, or related links.
Answer:
Data attributes (data-*) allow you to store extra information in standard HTML elements without other hacks or non-standard attributes.
Answer:
The <progress> element represents the completion progress of a task.
Answer:
The <meter> element represents a scalar measurement within a known range, such as disk usage or a temperature.
Answer:
<b> is for stylistic bold text, while <strong> indicates importance or seriousness of the content.
Answer:
<i> is for stylistic italic text, while <em> indicates emphasized text.
Answer:
The <time> element represents a specific time or date.
Answer:
The <mark> element highlights text for reference or notation purposes.
Answer:
Use the <img src="file.svg" alt="SVG Image"> tag or inline SVG using the <svg> element.
Answer:
The <aside> element represents content that is tangentially related to the content around it, such as sidebars or pull quotes.
Answer: Web workers allow JavaScript to run in the background, improving performance for complex tasks.
Answer:
The <main> element represents the dominant content of the <body> of a document.
Answer:
The <datalist> element provides a list of predefined options for input controls.
Answer:
The <output> element represents the result of a calculation or user action.
Answer:
The <embed> element is used for embedding external applications or interactive content.
Answer:
The <source> element specifies multiple media resources for <picture>, <audio>, or <video>.
Answer:
The <track> element specifies text tracks for <audio> or <video> elements, such as subtitles.
Answer:
The <picture> element allows you to specify multiple sources for an image, enabling responsive images.
Answer:
The <details> element creates a disclosure widget, and the <summary> element provides a summary or label for it.
Answer:
The <template> element holds content that is not rendered when the page loads but can be instantiated later via JavaScript.
Answer:
The <wbr> element indicates a word break opportunity—where a line break may occur if needed.
Answer:
The <keygen> element (deprecated in HTML5.2) was used for generating cryptographic keys in web forms.
Answer:
The <dialog> element creates a dialog box or window.
Answer:
The <menu> element represents a list of commands or options.
Answer:
The <command> element (deprecated) was used to define a command button.
Answer: These elements are used for ruby annotations, commonly used in East Asian typography.
Answer:
The <bdi> element isolates a span of text that might be formatted in a different direction from other text outside it.
Answer:
The open attribute in <details> specifies that the details should be visible (open) by default.
Answer: It creates a date picker input field.
Answer: It creates an input field for email addresses, with built-in validation.
Answer: It creates an input field for numeric values.
Answer: It creates a slider for selecting a value from a range.
Answer: It creates a search field.
Answer: It creates an input field for telephone numbers.
Answer: It creates an input field for URLs, with built-in validation.
Answer: It creates a color picker input field.
Answer: It creates a date and time picker input field, without timezone information.
Answer:
The placeholder attribute specifies a short hint that describes the expected value of an input field.