……. Let’s delve into the following example to learn more about how to set media file URLs in HTML. Example 1 In the following example, we use the audio tag. <"/> ……. Let’s delve into the following example to learn more about how to set media file URLs in HTML. Example 1 In the following example, we use the audio tag. <">

Home >Web Front-end >HTML Tutorial >How to set the URL of a media file in HTML?

How to set the URL of a media file in HTML?

WBOY
WBOYforward
2023-09-10 09:05:081343browse

How to set the URL of a media file in HTML?

In this article, we will learn how to set the URL of a media field in HTML.

Here, we will learn how to use HTML to create URLs for media files. We use the tag to specify the URL of the media file. Multimedia files (including audio, video, and image files) are attached using this tag. The element is contained within the

grammar

The following is the syntax of the element

<source src="" type="">…….</source>

Let’s dive into the following example to learn more about how to set media file URLs in HTML.

Example 1

In the following examples, we use the audio tag.

<!DOCTYPE html>
<html>
<body style="text-align: center;">
   <audio id="varma" controls>
      <source src="https://samplelib.com/lib/preview/mp3/sample-3s.mp3" type="audio/mpeg">
   </audio>
</body>
</html>

When the script executes, it will generate an output showing the audio files uploaded to the web page using the tag.

Example 2

Consider the following example where we use the tag with a video.

<!DOCTYPE html>
<html>
<body>
   <video width="400" height="350" controls>
      <source src="https://static.videezy.com/system/resources/previews/000/052/918/original/21.mp4"">
   </video>
</body>
</html>

When you run the above script, it will generate an output that contains the text used in the script as well as the colspan on the web page.

Example 3

Let's look at another example where we use the tag with an image.

<!DOCTYPE html>
<html>
<body>
   <h1>ELEPHANTS</h1>
   <p>Elephants are the largest existing land animals.</p>
   <p><br><img  src="https://www.tutorialspoint.com/assets/questions/media/500267-1671169181.png" alt="How to set the URL of a media file in HTML?" ></p>
</body>
</html>

If the script is executed, an output window will pop up showing the image uploaded to the web page using the tag.

The above is the detailed content of How to set the URL of a media file in HTML?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete