当前位置: 移动技术网 > IT编程>网页制作>Html5 > Html5新标签解释及用法

Html5新标签解释及用法

2019年07月25日  | 移动技术网IT编程  | 我要评论

好听好看的群名,婷婷社区,房地产报纸软文

它希望能够减少浏览器对于需要插件的丰富性网络应用服务(plug-in-based rich internet application,ria),如adobe flash, microsoft silverlight, 与 sun javafx 的需求。

html 5 提供了一些新的元素和属性,反映典型的现代用法网站。其中有些是技术上类似 <div> 和 <span> 标签,但有一定含义,例如 <nav>(网站导航块)和 <footer>。这种标签将有利于搜索引擎的索引整理、小屏幕装置和视障人士使用。同时为其他浏览要素提供了新的功能,通过一个标准接口,如 <audio> 和 <video> 标记。

一些过时的 html 4 标记将取消,其中包括纯粹用作显示效果的标记,如 <font> 和 <center>,因为它们已经被 css 取代。还有一些透过 dom 的网络行为(via)。

下面我们来看一下html 5提供的一些新的标签用法以及和html 4的区别。
<article>标签定义外部的内容。比如来自一个外部的新闻提供者的一篇新的文章,或者来自 blog 的文本,或者是来自论坛的文本。亦或是来自其他外部源内容。
html5:<article></article>
html4:<div></div>

<aside>标签定义 article 以外的内容。aside 的内容应该与 article 的内容相关。
html5:<aside>aside 的内容是独立的内容,但应与文档内容相关。</aside>
html4:<div>aside 的内容是独立的内容,但应与文档内容相关。</div>

<audio> 标签定义声音,比如音乐或其他音频流。
html5:<audio src="someaudio.wav">您的浏览器不支持 audio 标签。</audio>
html4:<object type="application/ogg" data="someaudio.wav"><param name="src" value="someaudio.wav"></object>

<canvas> 标签定义图形,比如图表和其他图像。这个 html 元素是为了客户端矢量图形而设计的。它自己没有行为,但却把一个绘图 api 展现给客户端 javascript 以使脚本能够把想绘制的东西都绘制到一块画布上。
html5:<canvas id="mycanvas" width="200" height="200"></canvas>
html4:<object data="inc/hdr.svg" type="image/svg+xml" width="200" height="200"></object>

<command> 标签定义命令按钮,比如单选按钮、复选框或按钮。
html5: <command onclick=cut()" label="cut">
html4: none

<datalist> 标签定义可选数据的列表。与 input 元素配合使用,就可以制作出输入值的下拉列表。
html5: <datalist></datalist>
html4: see combobox.

<details> 标签定义元素的细节,用户可进行查看,或通过点击进行隐藏。与 <legend> 一起使用,来制作 detail 的标题。该标题对用户是可见的,当在其上点击时可打开或关闭 detail。
html5: <details></details>
html4: <dl style="display:hidden"></dl>

<embed> 标签定义嵌入的内容,比如插件。
html5: <embed src="horse.wav" />
html4: <object data="flash.swf" type="application/x-shockwave-flash"></object>

<figcaption> 标签定义 figure 元素的标题。”figcaption” 元素应该被置于 “figure” 元素的第一个或最后一个子元素的位置。
html5: <figure><figcaption>prc</figcaption></figure>
html4: none

<figure> 标签用于对元素进行组合。使用 <figcaption> 元素为元素组添加标题。
html5: <figure><figcaption>prc</figcaption><p>the people's republic of china was born in 1949...</p></figure>
html4: <dl><h1>prc</h1><p>the people's republic of china was born in 1949...</p></dl>

<footer> 标签定义 section 或 document 的页脚。典型地,它会包含创作者的姓名、文档的创作日期以及/或者联系信息。
html5: <footer></footer>
html4: <div></div>

<header> 标签定义 section 或 document 的页眉。
html5: <header></header>
html4: <div></div>

<hgroup> 标签用于对网页或区段(section)的标题进行组合。
html5: <hgroup></hgroup>
html4: <div></div>

<keygen> 标签定义生成密钥。
html5: <keygen>
html4: none

<mark>主要用来在视觉上向用户呈现那些需要突出的文字。<mark>标签的一个比较典型的应用就是在搜索结果中向用户高亮显示搜索关键词。
html5: <mark></mark>
html4: <span></span>

<meter> 标签定义度量衡。仅用于已知最大和最小值的度量。必须定义度量的范围,既可以在元素的文本中,也可以在 min/max 属性中定义。
html5: <meter></meter>
html4: none

<nav> 标签定义导航链接的部分。
html5: <nav></nav>
html4:<ul></ul>

<output> 标签定义不同类型的输出,比如脚本的输出。
html5: <output></output>
html4: <span></span>

<progress> 标签运行中的进程。可以使用 <progress> 标签来显示 javascript 中耗费时间的函数的进程。
html5: <progress></progress>
html4: none

<rp> 标签在 ruby 注释中使用,以定义不支持 ruby 元素的浏览器所显示的内容。
html5: <ruby>漢 <rt><rp>(</rp>ㄏㄢˋ<rp>)</rp></rt></ruby>
html4: none

<rt> 标签定义字符(中文注音或字符)的解释或发音。
html5: <ruby>漢 <rt> ㄏㄢˋ </rt></ruby>
html4: none

<ruby> 标签定义 ruby 注释(中文注音或字符)。
html5: <ruby>漢 <rt><rp>(</rp>ㄏㄢˋ<rp>)</rp></rt></ruby>
html4: none

<section> 标签定义文档中的节(section、区段)。比如章节、页眉、页脚或文档中的其他部分。
html5: <section></section>
html4: <div></div>

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

<summary> 标签包含 details 元素的标题,”details” 元素用于描述有关文档或文档片段的详细信息。”summary” 元素应该是 “details” 元素的第一个子元素。
html5: <details><summary>html 5</summary>this document teaches you everything you have to learn about html 5.</details>
html4: none

<time> 标签定义日期或时间,或者两者。
html5: <time></time>
html4: <span></span>

<video> 标签定义视频,比如电影片段或其他视频流。
html5: <video src="movie.ogg" controls="controls">您的浏览器不支持 video 标签。</video>
html4:<object type="video/ogg" data="movie.ogv"><param name="src" value="movie.ogv"></object>

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网