HTML Media Tutorial
Welcome to our HTML media tutorial! In this tutorial, we will learn how to add different types of media, such as images, audio, and video, to our web pages using HTML.
Images
Images are a great way to make your website visually appealing. To add an image to your web page, you can use the <img>
tag. The <img>
tag is an empty tag, which means it does not have a closing tag. Here's an example:
<img src="image.jpg" alt="Description of the image">
The src
attribute specifies the URL of the image file, and the alt
attribute provides a text description of the image. This is important for accessibility and SEO purposes.
Audio
If you want to add audio to your web page, you can use the <audio>
tag. Here's an example:
<audio controls>
<source src="audio.mp3" type="audio/mpeg">
Your browser does not support the audio tag.
</audio>
The controls
attribute adds audio controls, such as play, pause, and volume. The <source>
tag specifies the audio file and its type.
Video
To add video to your web page, you can use the <video>
tag. Here's an example:
<video controls width="400" height="300">
<source src="video.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
Similar to the <audio>
tag, the <video>
tag allows you to specify the video file and its type. The controls
attribute adds video controls, and you can also set the width and height of the video player.
Conclusion
That's it for our HTML media tutorial! Now you know how to add images, audio, and video to your web pages using HTML. Experiment with different media types and have fun creating engaging content for your website!