HTML: Media, Links & Embedding Flashcards

Subtopics: Embedding images, audio, video Responsive media with srcset and picture Anchor links and target attributes Iframes and sandboxing Interview-style Questions: How do you make an image responsive? What’s the difference between , , and ? What are the security concerns with iframes? (20 cards)

1
Q

What tag is used to embed an image in HTML?

A

The <img></img> tag is used to embed an image in HTML pages.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How do you make an image responsive in HTML?

A

Use CSS max-width: 100% and height: auto, or use the <picture> element with srcset for different resolutions.</picture>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the <audio> tag used for?</audio>

A

The <audio> tag is used to embed sound content such as music or audio streams.</audio>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What does the <video> tag do in HTML?</video>

A

The <video> tag allows you to embed video files directly into an HTML page with controls like play, pause, and volume.</video>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the purpose of the srcset attribute in <img></img>?

A

srcset allows browsers to choose the most appropriate image based on device resolution and screen size.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What does the <picture> tag do?</picture>

A

The <picture> tag provides multiple source images for different scenarios, enabling art direction and responsive image loading.</picture>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is an anchor link in HTML?

A

An anchor link (<a>) is used to link to other pages, locations within the same page, or external URLs.</a>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What does the target="_blank" attribute do?

A

It opens the linked document in a new browser tab or window.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the <iframe> tag used for?

A

The <iframe> tag embeds another HTML page within the current one, such as YouTube videos or embedded widgets.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What are security risks of using iframes?

A

Iframes can be exploited for clickjacking, cross-site scripting, and loading malicious content if not sandboxed properly.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is the sandbox attribute in iframes?

A

sandbox restricts the iframe’s capabilities, improving security by disabling scripts, forms, and plugins unless explicitly allowed.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is the difference between <embed></embed>, <object>, and <iframe>?</object>

A

<embed></embed>

is for external resources (e.g. PDFs), <object> for general-purpose content (can fallback), <iframe> for embedding full web pages.</object>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What are the advantages of using <picture> and srcset?</picture>

A

They allow for responsive image loading, improving load time and user experience on different devices.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What are disadvantages of embedding large media files?

A

They increase page load time, can degrade performance, and may cause compatibility issues on some browsers.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is a best practice when using media tags?

A

Always provide fallback content or attributes like controls and preload to enhance accessibility and user experience.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What are good use cases for <iframe>?

A

Embedding third-party content like maps, videos, or analytics dashboards without integrating directly into your codebase.

17
Q

What is the architectural impact of heavy media usage?

A

Heavy media can strain bandwidth, increase load times, and require CDN strategies and caching for scalability.

18
Q

How does responsive media affect performance?

A

It optimizes asset loading for device capabilities, reducing load time and improving UX on mobile and slow networks.

19
Q

What are common interview questions about HTML media?

A

‘How do you make media responsive?’, ‘What are the security implications of using iframes?’, ‘Difference between embed, object, iframe?’

20
Q

What is a potential gotcha with <img></img> and srcset?

A

Browsers may choose unexpected sources from srcset if sizes and resolutions are not defined clearly.