Interview Question

What is the alt attribute?

Alt explains an image when it cannot be seen.

💡 Concept ✅ Quick Revision 🌐 HTML

Answer

The `alt` attribute provides a text replacement for an image. β€’ It is written inside an element’s opening tag. β€’ The HTML Standard limits which elements may use it and which values are valid. β€’ Browsers apply the attribute when they process the element or the resource it controls.

💡 Simple Example

<img src="dog.jpg" alt="A brown dog running">

⚡ Quick Revision

Alt explains an image when it cannot be seen.