Skip to content
Related Articles
Get the best out of our app
GFG App
Open App
geeksforgeeks
Browser
Continue

Related Articles

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

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

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:

My Personal Notes arrow_drop_up
Last Updated : 06 Jun, 2023
Like Article
Save Article
Similar Reads
Related Tutorials