Interview Question

What is the purpose of <picture>?

`<picture>` should be used for its proper HTML purpose.

💡 Concept ✅ Quick Revision 🌐 HTML

Answer

`<picture>` is an element that offers different image choices. • The browser selects a matching `<source>` and uses `<img>` as the fallback. • Browsers apply the native parsing and behavior defined for this element. • Using its native meaning helps assistive technology understand the content when the element has accessibility semantics.

💡 Simple Example

<picture><source srcset="wide.webp"><img src="small.jpg" alt="Park"></picture>

⚡ Quick Revision

`<picture>` should be used for its proper HTML purpose.