Open In App

How to specify the type of the media resource in HTML5 ?

Last Updated : 06 Jun, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

Here, we will see how to set the media type of the media resource using HTML. To select the media type of media resource we use the <source> tag. This tag is used to attach multimedia files like audio, video, and pictures to a web page or website. The <audio>, <video>, and <picture> elements contain the <source> element.

Syntax:

<source src="" type="">
   // Statements
</source>

Example: In this example, we will specify the media resources by using the <source> tag.

HTML




<!DOCTYPE html>
<html>
<head>
    <title>
        How to specify the media type
        of the media resource in HTML5?
    </title>
</head>
   
<body style="text-align: center;">
    <h1 style="color:green;">
        GeeksforGeeks
    </h1>
    <h3>
        How to specify the media type
        of the media resource in HTML5?
    </h3>
    <video width="400" height="350" controls>
        <source src=
                type="video/mp4">
    </video>
    </br></br>
    <audio controls>
        <source src=
                type="audio/mp3">
    </audio>
</body>
</html>


Output:



Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads