Posts in current category

HTML5 <source> tag


May 03, 2021 19:00 HTML5


Table of contents


HTML5 is used to define media resources for media elements. Please refer to the following example:

An audio player with two source files. The browser needs to select the source file it supports (or one if it does):

<audio controls> <source src="horse.ogg" type="audio/ogg"> <source src="horse.mp3" type="audio/mpeg"> 您的浏览器不支持 audio 元素。</audio>
Try it out . . .

Browser support

HTML5 <source> tag HTML5 <source> tag HTML5 <source> tag HTML5 <source> tag HTML5 <source> tag

IE 9 Plus, Firefox, Opera, Chrome, and Safari all support the hashtag.

Note: IE 8 or earlier versions of IE browsers do not support the label.


Label definition and instructions for use

Labels define media resources for media elements such as slt;video> and slt;audio>

The tab allows you to specify that two video/audio file co-browsers choose based on its support for media types or codec.


The difference between HTML 4.01 and HTML5

The label is the new label in HTML5.


Property

New: The new property in HTML5.

Property Value Describe
media New media_query Specify the type of media resources for the browser to decide whether to download.
src New Url Specify the URL of the media file.
type New MIME_type Specifies the type of MIME for media resources.

Global properties

The label supports the global properties of HTML.


The event property

The tag supports the event properties of HTML.