当前位置:高等教育资讯网  >  中国高校课件下载中心  >  大学文库  >  浏览文档

《高级Web技术》参考资料:html5(一)

资源类别:文库,文档格式:DOC,文档页数:17,文件大小:186KB,团购合买
点击下载完整版文档(DOC)

超文本标记语言(HTML)5第一次向HTML中引入新的元素。新的结构元素包括 aside、 figure和 section。新的内联元素包括time、 meter和 progres。新的内嵌元素有 video和 audio。新的交互 元素有 details、 datagrid和 commande 超文本标记语言(HTML的开发到1999年HTML4就停止了。万维网联盟(W3C把重点转向将HTML 的底层语法从标准通用标记语言(SGML)改为可扩展标记语言(ⅩML),以及可缩放向量图型(SVG) XForms和 Math ML这些全新的标记语言。浏览器厂商则把精力放到选项卡和富站点摘要(RSS)阅读 器这类浏览器特性上。Web设计人员开始学习使用异步 JavaScript+XML(Ajax),在现有的框架下 通过层叠样式表(CSS)和 JavaScript语言建立自己的应用程序。但是在接下来的八年中,HTML本 身没有任何变化 最近,它又复活了。三家重要的浏览器厂商一Appe、 Opera和 Mozilla foundation-成立了Web Hypertext Application Technology Working Group( WhatWG)来开发传统HTML的新版本。最 ,W3C也注意到了这些活动,也启动了自己的新一代HTML项目,双方的成员有很多是相同的。这两 个项目最终很可能合并。虽然很多细节还在争论之中,但下一版本HTML的大体轮廓已经清楚了。 Web开发人员从1999年就一直期待HTML的新版本(通常称为HTML5,但是也称为Web Applications1.0),现在它终于发布了。它保持了HTML原来的特色:没有名称空间或模式。元素不 必结束。浏览器会宽容地对待错误。p仍然是p,tab1e仍然是 table。 如果在1999年将一位Web开发人员冷冻起来,现在再解冻,那么他会遇到一些新的让人迷惑的元素。 是的,他熟悉的元素(比如div)仍然保留了:但是,HTML现在还包含 section、 header、 footer和 nav等新元素。em、coe和 strong仍然存在,但是增加了 meter、time和m。img和 embed仍然可 用,但是还增加了 video和 audio。但是,他仔细观察一下就会发现,这些元素实际上没什么区别。其 中许多元素可能在1999年是开发人员需要而没有得到的。通过与他已经掌握的元素进行简单的类比,这 些新元素都很容易理解。实际上,与Ajax或CSS相比,它们非常容易掌握 最后,当他打开300MHz的笔记本(运行的是 Windows98,也是在1999年冷冻起来的)时,他可 能对 Netscape4和 Windows@ Internet Explorer5中显示的新页面效果很吃惊。当然,这些老 式浏览器不认识新元素,会完全忽略它们,但是页面仍然会显示,内容仍然是完整的 这并不是什么虛构的故事。HTML5的设计原则就是在不支持它的浏览器中能够平稳地退化。原因很简单 我们都是这样的"原始人"。浏览器现在有选项卡、CSS和 Xm HtTp Request,但是它们的HTML显示 引擎仍然停留在1999年的水平。除了用户量大大增加之外,Web其实在本质上没什么进步。HTML5考 虑到了这一点。它目前为Web开发人员一些真正的好处,随着浏览器的缓慢升级,页面浏览者会逐渐享 受到这些好处。我们来看看HTML5提供了什么。 结构 由于缺少结构,即使是形式良好的HTML页面也比较难以处理。必须分析标题的级别,才能看出各个部 分的划分方式。边栏、页脚、页眉、导航条、主内容区和各篇文章都由通用的div元素来表示。HTML5 添加了一些新元素,专门用来标识这些常见的结构 section:这可以是书中的一章或一节,实际上可以是在HTML4中有自己的标题的任何东西 header:页面上显示的页眉:与head元素不一 footer:页脚:可以显示电子邮件中的签名 av:指向其他页面的一组链接 article:blog、杂志、文章汇编等中的一篇文章 我们来考虑一个典型的blog主页,它的顶部有页眉,底部有页脚,还有几篇文章、一个导航区和一个边 栏,见清单1

超文本标记语言(HTML)5 第一次向 HTML 中引入新的元素。新的结构元素包括 aside、figure 和 section。新的内联元素包括 time、meter 和 progress。新的内嵌元素有 video 和 audio。新的交互 元素有 details、datagrid 和 command。 超文本标记语言(HTML)的开发到 1999 年 HTML 4 就停止了。万维网联盟(W3C)把重点转向将 HTML 的底层语法从标准通用标记语言(SGML)改为可扩展标记语言(XML),以及可缩放向量图型(SVG)、 XForms 和 MathML 这些全新的标记语言。浏览器厂商则把精力放到选项卡和富站点摘要(RSS)阅读 器这类浏览器特性上。Web 设计人员开始学习使用异步 JavaScript + XML(Ajax),在现有的框架下 通过层叠样式表(CSS)和 JavaScript™ 语言建立自己的应用程序。但是在接下来的八年中,HTML 本 身没有任何变化。 最近,它又复活了。三家重要的浏览器厂商 — Apple、Opera 和 Mozilla Foundation — 成立了 Web Hypertext Application Technology Working Group(WhatWG)来开发传统 HTML 的新版本。最 近,W3C 也注意到了这些活动,也启动了自己的新一代 HTML 项目,双方的成员有很多是相同的。这两 个项目最终很可能合并。虽然很多细节还在争论之中,但下一版本 HTML 的大体轮廓已经清楚了。 Web 开发人员从 1999 年就一直期待 HTML 的新版本(通常称为 HTML 5,但是也称为 Web Applications 1.0),现在它终于发布了。它保持了 HTML 原来的特色:没有名称空间或模式。元素不 必结束。浏览器会宽容地对待错误。p 仍然是 p,table 仍然是 table。 如果在 1999 年将一位 Web 开发人员冷冻起来,现在再解冻,那么他会遇到一些新的让人迷惑的元素。 是的,他熟悉的元素(比如 div)仍然保留了;但是,HTML 现在还包含 section、header、footer 和 nav 等新元素。em、code 和 strong 仍然存在,但是增加了 meter、time 和 m。img 和 embed 仍然可 用,但是还增加了 video 和 audio。但是,他仔细观察一下就会发现,这些元素实际上没什么区别。其 中许多元素可能在 1999 年是开发人员需要而没有得到的。通过与他已经掌握的元素进行简单的类比,这 些新元素都很容易理解。实际上,与 Ajax 或 CSS 相比,它们非常容易掌握。 最后,当他打开 300MHz 的笔记本(运行的是 Windows 98,也是在 1999 年冷冻起来的)时,他可 能对 Netscape 4 和 Windows® Internet Explorer® 5 中显示的新页面效果很吃惊。当然,这些老 式浏览器不认识新元素,会完全忽略它们,但是页面仍然会显示,内容仍然是完整的。 这并不是什么虚构的故事。HTML 5 的设计原则就是在不支持它的浏览器中能够平稳地退化。原因很简单: 我们都是这样的 “原始人”。浏览器现在有选项卡、CSS 和 XmlHttpRequest,但是它们的 HTML 显示 引擎仍然停留在 1999 年的水平。除了用户量大大增加之外,Web 其实在本质上没什么进步。HTML 5 考 虑到了这一点。它目前为 Web 开发人员一些真正的好处,随着浏览器的缓慢升级,页面浏览者会逐渐享 受到这些好处。我们来看看 HTML 5 提供了什么。 结构 由于缺少结构,即使是形式良好的 HTML 页面也比较难以处理。必须分析标题的级别,才能看出各个部 分的划分方式。边栏、页脚、页眉、导航条、主内容区和各篇文章都由通用的 div 元素来表示。HTML 5 添加了一些新元素,专门用来标识这些常见的结构: • section:这可以是书中的一章或一节,实际上可以是在 HTML 4 中有自己的标题的任何东西 • header:页面上显示的页眉;与 head 元素不一样 • footer:页脚;可以显示电子邮件中的签名 • nav:指向其他页面的一组链接 • article:blog、杂志、文章汇编等中的一篇文章 我们来考虑一个典型的 blog 主页,它的顶部有页眉,底部有页脚,还有几篇文章、一个导航区和一个边 栏,见清单 1

清单1.典型的blog页面 mokkamitschlag Spring Comes (and Goes) in Sussex CountyYesterday I joined the Brooklyn Bird club for our annual trip to western New Jersey, specifically Hyper Humus, a relatively recently discovered hot spot. It started out as a nice winter morning when we arrived at the site at 7: 30 A.M., progressed to spring around 10: 00 A M, and reached early summer by 10: 15. div cl id="post-1000571"> But does it count for your life list? div class="entry seems you can now href="http://www.wired.com/science/discoveries/news/ 2007/04/cone_sf">bird watching via the Internet.I haven't been able to test it out yet (20 user limit apparently) but this is certainly cool Personally, I cant imagine it replacing actually being out in the field by any small amount on the other hand, I ve always found it qui te

清单 1. 典型的 blog 页面 Mokka mit Schlag Mokka mit Schlag Spring Comes (and Goes) in Sussex County Yesterday I joined the Brooklyn Bird Club for our annual trip to Western New Jersey, specifically Hyper Humus, a relatively recently discovered hot spot. It started out as a nice winter morning when we arrived at the site at 7:30 A.M., progressed to Spring around 10:00 A.M., and reached early summer by 10:15. But does it count for your life list? Seems you can now go bird watching via the Internet. I haven't been able to test it out yet (20 user limit apparently) but this is certainly cool. Personally, I can't imagine it replacing actually being out in the field by any small amount. On the other hand, I've always found it quite

sad to meet senior birders who are no longer able to hold binoculars steady or get to the park. I can imagine this might be of some interest to them.At I derly bi rder did a b he cou ld no longer get out so much. This certainly tops that. / div &laquo; Previous Entries div> /div> li>Info Comment PolicyTodo List Archi ves Apri12007 March2007 February2007 January2007 1> civ id=" foot Copyright 2007 Elliotte Rusty Harold d </html

sad to meet senior birders who are no longer able to hold binoculars steady or get to the park. I can imagine this might be of some interest to them. At least one elderly birder did a big year on TV, after he could no longer get out so much. This certainly tops that. &laquo; Previous Entries Info Comment Policy Todo List Archives April 2007 March 2007 February 2007 January 2007 Copyright 2007 Elliotte Rusty Harold

即使有正确的缩进,这些嵌套的div仍然让人觉得非常混乱。在HTML5中,可以将这些元素替换为语 义性的元素,见清单2 清单2.用HTML5编写的典型blog页面 Mokka mit schlag chlahref="http://www.eTharo.com/blog">mokkamitschlag /header> Yesterday I d the brooklyn bird club for our annual trip to western New Jersey, specifically Hyper Humus, a relatively recently discovered hot spot.It started out as a nice winter morning when we arrived at the site at 7 A.M., and reached early summer by 10: 15. article h2> But does it count for your life list? Seems you can now go bird watching via the Internet. I haven't been able to test it out yet (20 user limit apparently) but this is certainly cool t imagine it replacing actua ly being out in the field by any smallamount on the other hand, I ve always found it qui te ad to meet senior birders who are no longer able to old binoculars steady or get to the park. I can imagine this might be of some interest to them.At

即使有正确的缩进,这些嵌套的 div 仍然让人觉得非常混乱。在 HTML 5 中,可以将这些元素替换为语 义性的元素,见清单 2。 清单 2. 用 HTML 5 编写的典型 blog 页面 Mokka mit Schlag Mokka mit Schlag Spring Comes (and Goes) in Sussex County Yesterday I joined the Brooklyn Bird Club for our annual trip to Western New Jersey, specifically Hyper Humus, a relatively recently discovered hot spot. It started out as a nice winter morning when we arrived at the site at 7:30 A.M., progressed to Spring around 10:00 A.M., and reached early summer by 10:15. But does it count for your life list? Seems you can now go bird watching via the Internet. I haven't been able to test it out yet (20 user limit apparently) but this is certainly cool. Personally, I can't imagine it replacing actually being out in the field by any small amount. On the other hand, I've always found it quite sad to meet senior birders who are no longer able to hold binoculars steady or get to the park. I can imagine this might be of some interest to them. At

least one elderly birder did a big year on Tv, after he cou ld no longer get out so much. This certainl ps that. &laquo; Previous Entries /section> li>Info Todo List Archi ves Apri12007 March2007 February2007 ali>January 2007 footer> Copyright 2007 Elliotte Rusty Harold /footer> </html 现在不再需要div了。不再需要自己设置cass属性,从标准的元素名就可以推断出各个部分的意义 这对于音频浏览器、手机浏览器和其他非标准浏览器尤其重要 會回页首

least one elderly birder did a big year on TV, after he could no longer get out so much. This certainly tops that. &laquo; Previous Entries Info Comment Policy Todo List Archives April 2007 March 2007 February 2007 January 2007 Copyright 2007 Elliotte Rusty Harold 现在不再需要 div 了。不再需要自己设置 class 属性,从标准的元素名就可以推断出各个部分的意义。 这对于音频浏览器、手机浏览器和其他非标准浏览器尤其重要。 回页首

语义性的块元素 除了结构性元素之外,HTML5还增加了一些纯语义性的块级元素: dialog 我在文章和书中一直使用前两个元素。第三个元素我不经常用,它主要用于书面文本 aside de元素代表说明、提示、边栏、引用、附加注释等,也就是叙述主线之外的内容。例如,在 develo perWorks文章中,常常会看到用表格形式编写的边栏,见清单3 清单3.用HTML4编写的 developerWorks边栏 td r> .xf-value The .xf-value selector used here styles the input field value but not its label. This is actually inconsistent with the current css3 draft. the example really should use the :: value pseudo-class instead like so: pre class="displ aycode">input: value[ width: 20em; y Tue width: 18em y #zip:: value i width: 12em y #state: value[ width: 3em However, Firefox doesnt yet support this syntax 在HTML5中,可以按照更有意义的方式编写这个边栏,见清单4 清单4.用HTML5编写的 developerWorks边栏

语义性的块元素 除了结构性元素之外,HTML 5 还增加了一些纯语义性的块级元素: • aside • figure • dialog 我在文章和书中一直使用前两个元素。第三个元素我不经常用,它主要用于书面文本。 aside aside 元素代表说明、提示、边栏、引用、附加注释等,也就是叙述主线之外的内容。例如,在 developerWorks 文章中,常常会看到用表格形式编写的边栏,见清单 3。 清单 3. 用 HTML 4 编写的 developerWorks 边栏 .xf-value The .xf-value selector used here styles the input field value but not its label. This is actually inconsistent with the current CSS3 draft. The example really should use the ::value pseudo-class instead like so: input::value { width: 20em; } #ccnumber::value { width: 18em } #zip::value { width: 12em } #state::value { width: 3em } However, Firefox doesn't yet support this syntax. 在 HTML 5 中,可以按照更有意义的方式编写这个边栏,见清单 4。 清单 4. 用 HTML 5 编写的 developerWorks 边栏

The . xf-value selector used here styles the field value but not its label. This is actually inconsistent with the current css3 draft. The example really should use the code type="inline">:: va lue pseudo-class instead like so input: value i width: 20em; J #ccnumber: value[ width: 18em J #state: value i width: 3em However, Firefox doesn t yet support this syntax 浏览器可以决定把这个边栏放在哪里(可能需要用一点儿CSS代码) figure figure元素代表一个块级图像,还可以包含说明。例如,在许多 developerWorks文章中,可以看到 清单5这样的标记:其结果见图1。 清单5.用HTML4编写的 developerWorks图 Figure 2. Install Mozilla XForms dialog<br <img alt="A web site is requesting permission to install the fo l lowing item ms 0. 7 Unsign src="installdialog jpg"border="0" height=""317 hspace=5 vspace="5"width="331 br

.xf-value The .xf-value selector used here styles the input field value but not its label. This is actually inconsistent with the current CSS3 draft. The example really should use the ::value pseudo-class instead like so: input::value { width: 20em; } #ccnumber::value { width: 18em } #zip::value { width: 12em } #state::value { width: 3em } However, Firefox doesn't yet support this syntax. 浏览器可以决定把这个边栏放在哪里(可能需要用一点儿 CSS 代码)。 figure figure 元素代表一个块级图像,还可以包含说明。例如,在许多 developerWorks 文章中,可以看到 清单 5 这样的标记;其结果见图 1。 清单 5. 用 HTML 4 编写的 developerWorks 图 Figure 2. Install Mozilla XForms dialog

2 1. Install Mozilla XForms dialog A web site is requesting permission to install the Mozilla xforms 0.7 Unsigned fromhttp://releases.mozilla.org/pub/mo Malicious software can damage your computer or violate your privacy You should only install software from sources that you trust. Cancel Instal Now 在HTML5中,可以按照更有语义性的方式编写这个图,见清单6 清单6.用HTML5编写的 developerWorks图 Figure 2. Insta ll Mozilla xForms dialog 最重要的是,浏览器(尤其是屏幕阅读器)可以明确地将图和说明联系在一起。 figure元素不只可以显示图片。还可以使用它给 audio、 video、 iframe、 object和 embed元素加说 dialog dia1og元素表示几个人之间的对话。HTML5dt元素可以表示讲话者,HTML5dd元素可以表示讲话 内容。所以,在老式浏览器中也可以以合理的方式显示对话。清单7显示在 Galileo的" Dialogue Concerning the Two Chief World Systems"上的一段著名对话 清单7.用HTML5编写的 Galilean对话 simplicius According to the straight line AF and not according to the curve, such being already excluded

图 1. Install Mozilla XForms dialog 在 HTML 5 中,可以按照更有语义性的方式编写这个图,见清单 6。 清单 6. 用 HTML 5 编写的 developerWorks 图 Figure 2. Install Mozilla XForms dialog 最重要的是,浏览器(尤其是屏幕阅读器)可以明确地将图和说明联系在一起。 figure 元素不只可以显示图片。还可以使用它给 audio、video、iframe、object 和 embed 元素加说 明。 dialog dialog 元素表示几个人之间的对话。HTML 5 dt 元素可以表示讲话者,HTML 5 dd 元素可以表示讲话 内容。所以,在老式浏览器中也可以以合理的方式显示对话。清单 7 显示在 Galileo 的 “Dialogue Concerning the Two Chief World System s” 上的一段著名对话。 清单 7. 用 HTML 5 编写的 Galilean 对话 Simplicius According to the straight line AF, and not according to the curve, such being already excluded

for such a use. sagredo but i should take nei ther of them seeing that the straight line af runs obliquely. I should draw a line perpendicular to CD, for this would seem to me to be the shortest, as well as being unique among the infinite number of longer and unequal ones which may be drawn from the point a to every other point of the opposite line CD. salviati Your choi ce and the reason you adduce for it seem to me most excellent. so now we have it that the first dimension is determined by a straight line the second (namely, breadth) by another straight line, and not only straight, but at right angles to that which determines the length. Thus we have defined the two dimensions of a surface; that is, length and breadth. had to determine a he ight-for example, how high this platform is from the pavement down be low there. Seeing that from any point in the plat form we may draw infinite lines, curved or straight, and all of lengths, to the infinite points of the pavement be low, which of all these lines would you make use of? </p / dialo 对于这个元素的准确语法还有争议。一些人希望在 dialog元素中嵌入非对话文本(比如剧本中的舞台说 明),还有人不喜欢扩展dt和dd元素的作用。尽管在具体语法方面有争议,但是大多数人都认为以这 样的语义性方式表达对话是好事情。 回页首 语义性内联元素

for such a use. Sagredo But I should take neither of them, seeing that the straight line AF runs obliquely. I should draw a line perpendicular to CD, for this would seem to me to be the shortest, as well as being unique among the infinite number of longer and unequal ones which may be drawn from the point A to every other point of the opposite line CD. Salviati Your choice and the reason you adduce for it seem to me most excellent. So now we have it that the first dimension is determined by a straight line; the second (namely, breadth) by another straight line, and not only straight, but at right angles to that which determines the length. Thus we have defined the two dimensions of a surface; that is, length and breadth. But suppose you had to determine a height—for example, how high this platform is from the pavement down below there. Seeing that from any point in the platform we may draw infinite lines, curved or straight, and all of different lengths, to the infinite points of the pavement below, which of all these lines would you make use of? 对于这个元素的准确语法还有争议。一些人希望在 dialog 元素中嵌入非对话文本(比如剧本中的舞台说 明),还有人不喜欢扩展 dt 和 dd 元素的作用。尽管在具体语法方面有争议,但是大多数人都认为以这 样的语义性方式表达对话是好事情。 语义性内联元素 回页首

HTML4用5个不同的内联元素表示略有差异的计算机代码:var、code、kbd、tt和samp。但是,它 无法表示时间、数字等基本数值。HTML5提供了几个新的内联元素来满足非技术作者的需求。 m元素表示文本被"加上标志”,但是不一定要强调。可以把它想像成书中突出显示的一节。 Google的缓 存页面就是典型的用例。如果链接到一个缓存的副本,搜索词就被加上标志。例如,如果搜索" Egret", 那么缓存的 Google页面可能像下面这样 The Great Egret Ca lso known as the American EgretEgret flies with slow wing beats. The scientific name of the Great Egret is Casmerodius 对于这个元素的名称当前还有争议。在规范发布之前,它可能从m改为mark。 time time元素表示一个时间值,比如5:35PM, EST, April23,2007。例如: 5: 35 P.M. on April 23rd time元素可以帮助浏览器和其他程序识别出HTML页面中的时间。它不要求对元素内容应用任何特定的 格式。但是,每个time元素都应该有一个 datetime属性,其中包含更适合机器识别的时间值,比如: I am writing this example at 5: 35 P.M. on April 23rd 适合机器读取的时间值可能对搜索引擎、日历程序等有帮助 meter元素表示指定范围内的数字值。例如,可以用它表示薪水、投票给 Le pen的法国选民的百分比或 考试分数。在这里,我使用 meter标出 Software Deve lopment2007上一位 Google程序员提供的 p>An entry level programmer in silicon valley can expect to start around $90, 000 per year meter元素帮助浏览器和其他客户机识别HTML页面中的数量。它不要求对元素内容应用任何特定的格 式。但是,每个 meter元素可以有最多6个属性,它们按照更适合机器识别的形式表示这个数量: high

HTML 4 用 5 个不同的内联元素表示略有差异的计算机代码:var、code、kbd、tt 和 samp。但是,它 无法表示时间、数字等基本数值。HTML 5 提供了几个新的内联元素来满足非技术作者的需求。 m m 元素表示文本被 “加上标志”,但是不一定要强调。可以把它想像成书中突出显示的一节。Google 的缓 存页面就是典型的用例。如果链接到一个缓存的副本,搜索词就被加上标志。例如,如果搜索 “Egret”, 那么缓存的 Google 页面可能像下面这样: The Great Egret (also known as the American Egret) is a large white wading bird found worldwide. The Great Egret flies with slow wing beats. The scientific name of the Great Egret is Casmerodius albus. 对于这个元素的名称当前还有争议。在规范发布之前,它可能从 m 改为 mark。 time time 元素表示一个时间值,比如 5:35 P.M., EST, April 23, 2007。例如: I am writing this example at 5:35 P.M. on April 23rd. time 元素可以帮助浏览器和其他程序识别出 HTML 页面中的时间。它不要求对元素内容应用任何特定的 格式。但是,每个 time 元素都应该有一个 datetime 属性,其中包含更适合机器识别的时间值,比如: I am writing this example at 5:35 P.M. on April 23rd. 适合机器读取的时间值可能对搜索引擎、日历程序等有帮助。 meter meter 元素表示指定范围内的数字值。例如,可以用它表示薪水、投票给 Le Pen 的法国选民的百分比或 考试分数。在这里,我使用 meter 标出 Software Development 2007 上一位 Google 程序员提供的 数据: An entry level programmer in Silicon Valley can expect to start around $90,000 per year. meter 元素帮助浏览器和其他客户机识别 HTML 页面中的数量。它不要求对元素内容应用任何特定的格 式。但是,每个 meter 元素可以有最多 6 个属性,它们按照更适合机器识别的形式表示这个数量: • value • min • low • high • max

点击下载完整版文档(DOC)VIP每日下载上限内不扣除下载券和下载次数;
按次数下载不扣除下载券;
24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
共17页,试读已结束,阅读完整版请下载
相关文档

关于我们|帮助中心|下载说明|相关软件|意见反馈|联系我们

Copyright © 2008-现在 cucdc.com 高等教育资讯网 版权所有