The HTML5 source tag is a media element (such as <video> and <audio>) that defines media resources. The <source> tag allows you to specify alternative video/audio files for the browser to select based on its support for media types or codecs. Here, the host will tell you about the application attributes and examples of the source tag.
<source> tag attributes:| property | value | describe |
| media | media query | Specifies the type of media resource. |
| src | url | Specifies the URL of the media file. |
| type | numeric value | Specifies the MIME type of the media resource. |
The <source> tag supports global attributes and event attributes in HTML.
Application examples:Audio player with two source files. The browser should select which files it supports (if any):
<audio controls> <source src=horse.ogg type=audio/ogg> <source src=horse.mp3 type=audio/mpeg> Your browser does not support the audio element.</audio>
Output:
Differences between HTML 4.01 and HTML 5
The <source> tag is a new tag in HTML 5.
SummarizeThe above is the HTML5 source tag that the editor introduces to you: media elements define media resources. I hope it will be helpful to you. If you have any questions, please leave me a message and the editor will reply to you in time. I would also like to thank everyone for your support of the VeVb martial arts website!