source Tag in HTML

0
114

The `<source>` tag is an HTML5 tag that is used to specify the media source and its type for an audio or video element. This tag is used in conjunction with the `<audio>` and `<video>` tags to define the source of media.

Here’s an example of how to use the `<source>` tag to specify a video source:

<video controls>
<source src=”example.mp4″ type=”video/mp4″>
Your browser does not support the video tag.
</video>

In this example, the `<source>` tag specifies the source of the video as “example.mp4” and the type of video as “video/mp4”. If the user’s browser does not support the video tag, then the message “Your browser does not support the video tag” is displayed.

Here’s another example of how to use the `<source>` tag to specify an audio source:

<audio controls>
<source src=”example.mp3″ type=”audio/mpeg”>
Your browser does not support the audio tag.
</audio>

In this example, the `<source>` tag specifies the source of the audio as “example.mp3” and the type of audio as “audio/mpeg”. If the user’s browser does not support the audio tag, then the message “Your browser does not support the audio tag” is displayed.

Also Read:  label Tag in HTML

It’s important to note that the `<source>` tag can be used multiple times within an `<audio>` or `<video>` element to provide fallback sources in case the first one is not supported by the user’s browser. Here’s an example:

<video controls>
<source src=”example.mp4″ type=”video/mp4″>
<source src=”example.webm” type=”video/webm”>
Your browser does not support the video tag.
</video>

In this example, two sources are specified using the `<source>` tag. The first source is “example.mp4” with a type of “video/mp4”, and the second source is “example.webm” with a type of “video/webm”. If the user’s browser does not support either of these formats, then the message “Your browser does not support the video tag” is displayed.

In summary, the `<source>` tag is an essential component of the HTML5 audio and video elements, allowing you to specify the source and type of media. It’s important to use the `<source>` tag correctly to provide fallback sources for unsupported media types, ensuring that your audio and video content is accessible to all users.

Previous articlesmall Tag in HTML
Next articlespan Tag in HTML
Namaskaar, Friends main Kapil byteshastra.com ka Founder hu. Mere kai English blog bhi hai ,par mera motive yahan par easy language mein Technology se related Gyan ko aap tak pahunchane ka hai .taki aap kuch naya shikh sake. meri koshish hai ki bilkul simple tarike se aap ko nyi updates deta rahu taki aap bhi technology ke is yug mein peeche na rahe aur shikte rahe.Mujhse judne ke liye app mujhe Social Media par follow kar sakte hai.

Leave a Reply