Which HTML tag is most appropriate for displaying a variable name within a code snippet?
Explanation:
The <var>
tag is specifically meant to represent a variable within programming code. While you could use <code>
for the entire code snippet, using <var>
for variables makes the code more readable and meaningful.
Which type of Web Storage is designed to store data for the duration of the user's browsing session?
Explanation:
Data stored in sessionStorage
persists only for the duration of the user's session in the browser. It is deleted when the user closes the tab or window.
What attribute is used to define a regular expression that user input must match in a form field?
Explanation:
The 'pattern' attribute, used with input elements, allows you to specify a regular expression. User input must match this pattern for the input to be considered valid.
What is a key difference between using <iframe> and <object> for embedding content?
Explanation:
The key difference lies in how they handle the embedded content. An <iframe> creates a completely separate browsing context, like a mini-window within your webpage. In contrast, <object> embeds content as if it were part of your webpage, affecting things like scripting and layout.
What does SVG stand for in the context of web development?
Explanation:
SVG stands for Scalable Vector Graphics. It's an XML-based language used for describing two-dimensional vector graphics, which remain sharp and clear at any size.
What is the primary purpose of Web Workers in HTML5?
Explanation:
Web Workers allow you to run JavaScript code in a separate thread, preventing long-running scripts from blocking the main user interface thread and improving responsiveness.
What does the hidden
attribute do to an HTML element?
Explanation:
The hidden
attribute controls an element's visibility. When present, the element is not rendered on the page, but it still exists in the document structure.
Which HTML5 element is used to embed audio content in a webpage?
Explanation:
The <audio> element in HTML5 enables the embedding of sound content directly into webpages. It supports various audio formats and provides controls for playback.
What is the primary purpose of the HTML5 <canvas> element?
Explanation:
The <canvas> element provides a rectangular area on a webpage where developers can use JavaScript to draw and manipulate graphics dynamically. This enables the creation of animations, games, visualizations, and more.
Which HTML element is used to indicate a lengthy quotation from another source?
Explanation:
The <blockquote>
tag is specifically designed for long quotations. Browsers often indent content within <blockquote>
tags to visually set them apart from surrounding text.
Which HTML5 element is used to define the main content of a webpage?
Explanation:
The <main> element is specifically designed to represent the dominant content within the body of an HTML document. It's intended to enclose the content that's directly related to the central topic of the page.
What is the primary purpose of the viewport meta tag in responsive web design?
Explanation:
The viewport meta tag controls how the webpage is displayed on different devices. It defines the width, initial zoom level, and other properties of the viewport, ensuring that the website is optimized for various screen sizes.
Which HTML5 input type is used to let the user enter a URL?
Explanation:
The 'url' input type designates a field intended for entering a web address. Browsers often provide validation and may adjust the keyboard layout for easier URL input.
How do you store custom data associated with an HTML element, specifically for JavaScript access?
Explanation:
The data-*
attributes provide a way to embed custom data directly into HTML elements. These attributes can be easily accessed and manipulated using JavaScript.
Which attribute is used to control the order in which elements receive focus when the user navigates with the Tab key?
Explanation:
The tabindex
attribute specifies the tab order for an element. Elements with a positive tabindex
value are focused in ascending order, followed by elements without a tabindex
.