html5 How to use source tag? Introduction to html5 source tag attributes. Now let’s introduce the content of this article, mainly telling you about the use of html5 source tags and a detailed introduction to the three attributes of html5 source tags
html5 source tag definition and usage:
The
HTML5
Audio player with two source files. The browser should select the 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>
media : The type of media resource for the browser to decide whether to download (value: media_query).
src: URL of the media file (value: URL).
type: The MIME type of the media resource (value: MIME_type).
Note: The
html5 source tag format:
<source src="媒体资源地址" />
HTML5
Use media attribute:
<source src="movie.ogg" type="video/ogg" media="screen and (min-width:320px)">
HTML5
The media attribute specifies the type of media resource (what media/device the file is optimized for).
The browser can use this attribute to determine whether it can play the file. If you can't play it, you can choose not to download it.
Note: This attribute can accept multiple values.
HTML5
<source media="value">
Note: Because any browser does not support the media attribute of the
HTML5
The definition and usage of HTML5
src attribute Specifies the URL of the media file to be played.
HTML5
<source src="URL">
HTML5
Audio player with two resource files. The browser should choose which file 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>
Attribute value of HTML5
HTML5
HTML5
The type attribute specifies the media The MIME type of the resource.
Usage of type attribute:
<audio controls> <source src="horse.ogg" type="audio/ogg"> <source src="horse.mp3" type="audio/mpeg"> 您的浏览器不支持 audio 元素。 </audio>
HTML5
<source type="MIME_type">
HTML5
Differences between HTML 4.01 and HTML 5
The
Browser support:
Internet Explorer 9, Firefox, Opera, Chrome and Safari support the
Note: Internet Explorer 8 and earlier versions do not support the
【Related Recommendations】
html What is the role of the meta tag? Introduction to common attributes of html meta tags
The above is the detailed content of How to use html5 source tag? Introduction to html5 source tag attributes. For more information, please follow other related articles on the PHP Chinese website!