Loading...
Loading...
00:00:00

<audio>, <video>,<source> Tags in HTML5

The <audio> and <video> tags in HTML5 are used to embed audio and video files, respectively, within a HTML document. These tags provide a simple and effective way to add multimedia content to your web pages, without the need for additional plug-ins or software.

Here's an example of how to use the <audio> tag:

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

In this example, the <audio> tag is used to embed an audio file in the HTML document. The controls attribute is used to display controls for playing the audio, such as play/pause buttons and a volume slider. The <source> tag is used to specify the source of the audio file, in this case an MP3 file.

Here's a basic example of how to use the <video> tag:

<video controls>
  <source src="example.mp4" type="video/mp4">
  Your browser does not support the video element.
</video>

In this example, the <video> tag is used to embed a video file in the HTML document. The controls attribute is used to display controls for playing the video, such as play/pause buttons, a progress bar, and a volume slider. The <source> tag is used to specify the source of the video file, in this case an MP4 file.

Both the <audio> and <video> tags support a range of attributes, such as autoplay, loop, and muted, that allow you to control the behavior of the multimedia content.

The <audio> and <video> tags in HTML5 provide a simple and efficient way to embed audio and video content directly into a HTML document. Whether you're adding background music to your website, or a video tutorial to your online course, these tags offer a convenient way to include multimedia content in your web pages, without the need for additional plugins or software.