In the previous chapter you learnt about the SECTION Element. Now with this chapter we will learn about the SOURCE Element, Which is used as a child element of VIDEO Element and AUDIO Element.
The SOURCE Element is used as a child element of AUDIO and VIDEO Element. The SOURCE Element searches the source file and call it inside the main element.
The SOURCE Element contains mainly three attributes: src (media file searching), type (media file format) and media (not supported in any browsers).
Here is the Syntax for SOURCE Element
Supported Browser
<source src="" type=""/>
Below is complete syntax along with example
<!DOCTYPE html> <html> <head> <title>Title name will go here</title> </head> <body> <audio controls> <source src="media/simple_audio.mp3" type="audio/mpeg"/> <source src="media/simple_audio.ogg" type="audio/ogg"/> <!-- This line will be called when you are running an old browser --> <p>Your file doesn't support the audio element</p> </audio> </body> </html>