教程集 www.jiaochengji.com
教程集 >  前端编程  >  HTML5教程  >  正文 html5 source标签怎么用?html5 source标签属性介绍

html5 source标签怎么用?html5 source标签属性介绍

发布时间:2020-05-25   编辑:jiaochengji.com
教程集为您提供html5 source标签怎么用?html5 source标签属性介绍等资源,欢迎您收藏本站,我们将为您提供最新的html5 source标签怎么用?html5 source标签属性介绍资源
html5 source标签怎么用?html5 source标签属性介绍。现在开始介绍本篇文章的内容,主要给大家讲的是html5 source标签的使用和html5 cource标签的三个属性具体的介绍

html5 source标签定义和用法:

<source> 标签为媒介元素(比如 <video> 和 <audio>)定义媒介资源。

<source> 标签允许您规定可替换的视频/音频文件供浏览器根据它对媒体类型或者编解码器的支持进行选择。

HTML5<source>标签实例:

拥有两份源文件的音频播放器。浏览器应该选择它所支持的文件(如果有的话):

<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>

<source>标签基本属性:

  • media:媒体资源的类型,供浏览器决定是否下载(值:media_query)。

  • src:媒体文件的 URL(值:URL)。

  • type:媒体资源的 MIME 类型(值:MIME_type)。

注:<source>标签标签支持html全局属性和html事件属性

html5 source标签的格式:

<source src="媒体资源地址" />

HTML5<source>media属性:

使用 media 属性:

<source src="movie.ogg" type="video/ogg" media="screen and (min-width:320px)">

HTML5<source>media属性定义和用法:

media 属性规定媒体资源的类型(文件是为何种媒体/设备进行了优化)。

浏览器可使用该属性来判断它是否能播放这个文件。如果不能播放,则可以选择不进行下载。

注释:该属性可接受多个值。

HTML5<source>media属性语法:

<source media="value">

注:因为任何浏览器都不支持<source>标签的media属性。所以就不多说了。

HTML5<source>src属性:

HTML5<source>src属性的定义和用法:

src 属性规定要播放的媒体文件的 URL。

HTML5<source>src属性的语法:

<source src="URL">

HTML5<source>src属性的使用实例:

带有两个资源文件的音频播放器。浏览器应该选择它支持的那个文件(如果有的话):

<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>

HTML5<source>src属性的属性值:

tusan.png

HTML5<source>type属性:

HTML5<source>type属性的定义和用法:

type 属性规定媒体资源的 MIME 类型。

type 属性的使用:

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

HTML5<source>type属性的语法:

<source type="MIME_type">

HTML5<source>type属性的属性值:

tuer.png

HTML 4.01 与 HTML 5 之间的差异

<source> 标签是 HTML 5 中的新标签。

浏览器支持:

Internet Explorer 9 , Firefox, Opera, Chrome 以及 Safari 支持 <source> 标签。

注释:Internet Explorer 8 以及更早的版本不支持 <source> 标签。

【相关推荐】

html meta标签的作用是什么?html meta标签常见的属性介绍

html map标签是什么?html map标签的结构及具体使用方法详解

以上就是html5 source标签怎么用?html5 source标签属性介绍的详细内容,更多请关注教程集其它相关文章!

-->
  • 本文原创发布教程集,转载请注明出处,感谢您的尊重!
  • 您可能感兴趣的文章:
    html5 source标签怎么用?html5 source标签属性介绍
    html5 source type有什么用处?html5 source标签的详细介绍
    html5 meter标签是什么意思?html5 meter标签的用法及属性介绍
    html5如何插入可自动播放的音频(图文)
    html5 track标签是什么意思?html5 track标签的使用方法介绍
    html5中video标签的详细介绍
    HTML5中video标签如何使用
    html5新增标签有哪些?html5新增的标签应用
    html5 command标签的用法和<command>标签的使用案例详解
    html5 details标签的作用是什么?<details>标签的使用方法介绍(附使用实例)

    [关闭]
    ~ ~