Skip to content
Related Articles

Related Articles

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

View Discussion
Improve Article
Save Article
  • Last Updated : 26 Mar, 2021
View Discussion
Improve Article
Save Article

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

Syntax:

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

Example:

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
Recommended Articles
Page :

Start Your Coding Journey Now!