Preparation
🌐 ⏐ HTML5 Questions
6. Media Tags

Media Tags

<img>

<img src="image.jpg" alt="Description" />

The <img> tag is used to embed images into a webpage. The src attribute specifies the path to the image file, and the alt attribute provides alternative text for accessibility purposes and if the image fails to load.

<audio>

<audio controls>
  <source src="audio.mp3" type="audio/mpeg" />
  Your browser does not support the audio element.
</audio>

The <audio> tag is used to embed audio content into a webpage. The controls attribute adds playback controls like play, pause, and volume. The <source> tag specifies the audio file source and its type.

<video>

<video width="320" height="240" controls>
  <source src="video.mp4" type="video/mp4" />
  Your browser does not support the video tag.
</video>

The <video> tag is used to embed video content into a webpage. Similar to <audio>, the controls attribute adds playback controls. The <source> tag specifies the video file source and its type, and alternative text can be provided for unsupported browsers.

These media tags allow developers to include various types of media content, such as images, audio, and video, enhancing the user experience and providing rich multimedia content on webpages.