Media tags
HTML Media Tags
We will look at some HTML elements that are used for displaying media. The gallery below will show examples of the following tags.
- Image (IMG)
- Audio
- Video
Image Tags
The image tag <IMG> is used to display images.
Sample Image Code
Other attributes in a HTML Tag
Alt - This is alternative text describing the image. Users will see this text displayed if the image URL is wrong, the image is not in one of the supported formats, or if the image is hasn’t downloaded.
Height - You can specify the height of the image in pixels or as a percentage.
Width - You can specify the width of the image in pixels or as a percentage.
Audio Tags
The audio tag is used to embed a sound clip in a web page. The main supported file types are mp3 and ogg files.
Other attributes in an Audio tag
Controls - If this attribute is specified then the controls for playback will be displayed
Autoplay - The sound file will be automatically played once the page loads
Loop - The sound will automatically navigate to the start
Volume - A value between 0.0(silence) and 1.0(loudest)
Example audio element using these attributes:
Video Tags
The audio tag is used to embed a sound clip in a web page. The main supported file types are mp4 and ogg files.
Other attributes in a Video tag
Controls - If this attribute is specified then the controls for playback will be displayed
Autoplay - The sound file will be automatically played once the page loads
Loop - The sound will automatically navigate to the start
Volume - A value between 0.0(silence) and 1.0(loudest)