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
The following is the syntax of the
<source src="" type="">…….</source>
Let’s dive into the following example to learn more about how to set media file URLs in HTML.
In the following examples, we use the
<!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
Consider the following example where we use the
<!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.
Let's look at another example where we use the
<!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
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!