HTML Interview10 Q&A

HTML Links and Media Interview

Frequently asked interview questions on anchors, images, audio/video, and media best practices.

Topics: anchor attributes, relative vs absolute URLs, image accessibility, responsive media, lazy loading, figure/figcaption, downloadable links, media formats, fallback content, best practices.
1Difference between relative and absolute URL?easy
Answer: Relative URLs are path-based from current location; absolute URLs include full protocol and domain.
2How to open a link in new tab safely?easy
Answer: Use target="_blank" with rel="noopener noreferrer".
3Why is image alt required?medium
Answer: It supports screen readers and acts as fallback when images fail.
4What is the use of figure and figcaption?medium
Answer: They semantically group media with a descriptive caption.
5How to make images responsive?medium
Answer: Use CSS like max-width:100%; height:auto; and proper container sizing.
6What does loading="lazy" do?easy
Answer: Defers off-screen image loading until needed, improving initial performance.
7Which tags embed media natively?easy
Answer: audio and video with multiple source formats.
8Why provide media fallback content?medium
Answer: It helps browsers/devices that cannot play a given format.
9How to create download links?easy
Answer: Use anchor with download attribute.
10Top interview best practice for links/media?medium
Answer: Combine accessibility (alt/captions), security (rel attrs), and performance (lazy loading/compression).