超文本标记语言(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页面 <html t sch /title> <hl><ahref="http://www.etharo.com/blog">mokkamitschlag</a</h1 ost id="post-1000572 /blog/birding/2007/04/23/spring-comes-and-goes-in-sussex-county/> Spring Comes (and Goes) in Sussex County</a></h2 d entry <p>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. </p> </d </div> div cl id="post-1000571"> <h2><a href /blog/birding/2007/04/23/but-does-it-count-for-your-life-list/"> But does it count for your life list?</a></h2> div class="entry <p>seems you can now href="http://www.wired.com/science/discoveries/news/ 2007/04/cone_sf">bird watching via the Internet<a>.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 页面 <html> <head> <title>Mokka mit Schlag </title> </head> <body> <div id="page"> <div id="header"> <h1><a href="http://www.elharo.com/blog">Mokka mit Schlag</a></h1> </div> <div id="container"> <div id="center" class="column"> <div class="post" id="post-1000572"> <h2><a href= "/blog/birding/2007/04/23/spring-comes-and-goes-in-sussex-county/"> Spring Comes (and Goes) in Sussex County</a></h2> <div class="entry"> <p>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. </p> </div> </div> <div class="post" id="post-1000571"> <h2><a href= "/blog/birding/2007/04/23/but-does-it-count-for-your-life-list/"> But does it count for your life list?</a></h2> <div class="entry"> <p>Seems you can now go <a href="http://www.wired.com/science/discoveries/news/ 2007/04/cone_sf">bird watching via the Internet</a>. 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. </p> / div <div class="alignleft"> <a href="/blog/page/2/">« Previous Entries</a> <div class="alignright"></div> div> /div> <div id="right" class="co lumn" <ul id="sidebar"> li><h2>Info</h2> <li><a href="/blog/comment-policy/">Comment Policy</a></1 <li><a href="/blog/todo-list/">Todo List</a></i> <li><h2>Archi ves</h2> <u1> <1i>< a href='/blog/200704/>Apri12007</a</1i> <1i>< a href='/blog/2007/03/'> March2007</a</1i> <1i>< a href='/b1og/2007/02/'> February2007</a></1i> <1i>< a href='/b1og/2007/01/> January2007</a></1i> </ul> 1> civ id=" foot <p>Copyright 2007 Elliotte Rusty Harold</p> </div> 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.</p> </div> </div> </div> <div class="navigation"> <div class="alignleft"> <a href="/blog/page/2/">« Previous Entries</a> </div> <div class="alignright"></div> </div> </div> <div id="right" class="column"> <ul id="sidebar"> <li><h2>Info</h2> <ul> <li><a href="/blog/comment-policy/">Comment Policy</a></li> <li><a href="/blog/todo-list/">Todo List</a></li> </ul></li> <li><h2>Archives</h2> <ul> <li><a href='/blog/2007/04/'>April 2007</a></li> <li><a href='/blog/2007/03/'>March 2007</a></li> <li><a href='/blog/2007/02/'>February 2007</a></li> <li><a href='/blog/2007/01/'>January 2007</a></li> </ul> </li> </ul> </div> <div id="footer"> <p>Copyright 2007 Elliotte Rusty Harold</p> </div> </div> </body> </html>
即使有正确的缩进,这些嵌套的div仍然让人觉得非常混乱。在HTML5中,可以将这些元素替换为语 义性的元素,见清单2 清单2.用HTML5编写的典型blog页面 <html <title>Mokka mit schlag </title> </head <header> chlahref="http://www.eTharo.com/blog">mokkamitschlag</a</h1> /header> <section> <article> <h2><a href /blog/birding/2007/04/23/spring-comes-and-goes-in-sussex-county/ Spring Comes (and Goes) in Sussex County</a></h2 <p>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. </p> article h2><a href /blog/birding/2007/04/23/but-does-it-count-for-your-life-list/> But does it count for your life list?</a></h2> <p>Seems you can now go <a href=http://www.wiredcom/science/discoveries/news/ 2007/04/cone_ sf">bird watching via the Internet</a>. 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 页面 <html> <head> <title>Mokka mit Schlag </title> </head> <body> <header> <h1><a href="http://www.elharo.com/blog">Mokka mit Schlag</a></h1> </header> <section> <article> <h2><a href= "/blog/birding/2007/04/23/spring-comes-and-goes-in-sussex-county/"> Spring Comes (and Goes) in Sussex County</a></h2> <p>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. </p> </article> <article> <h2><a href= "/blog/birding/2007/04/23/but-does-it-count-for-your-life-list/"> But does it count for your life list?</a></h2> <p>Seems you can now go <a href="http://www.wired.com/science/discoveries/news/ 2007/04/cone_sf">bird watching via the Internet</a>. 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. </p> </article> <a href="/blog/page/2/">« Previous Entries</a> /section> <nav> <u I> li><h2>Info</h2> <li><a href="/blog/comment-policy/"Comment Policy</a></li> <li><a href="/blog/todo -list/">Todo List</a></i> <li><h2>Archi ves</h2> <1i>< a href='/b1og/2007/04/'>Apri12007</a</1 <1i>< a href='/blog/2007/03/'> March2007</a</1i> <1i>< a href='/b1og/2007/02/'> February2007</a></1i> ali><a href="/blog/2007/01/'>January 2007</a></li> </1i> footer> <p>Copyright 2007 Elliotte Rusty Harold</p> /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.</p> </article> <nav> <a href="/blog/page/2/">« Previous Entries</a> </nav> </section> <nav> <ul> <li><h2>Info</h2> <ul> <li><a href="/blog/comment-policy/">Comment Policy</a></li> <li><a href="/blog/todo-list/">Todo List</a></li> </ul></li> <li><h2>Archives</h2> <ul> <li><a href='/blog/2007/04/'>April 2007</a></li> <li><a href='/blog/2007/03/'>March 2007</a></li> <li><a href='/blog/2007/02/'>February 2007</a></li> <li><a href='/blog/2007/01/'>January 2007</a></li> </ul> </li> </ul> </nav> <footer> <p>Copyright 2007 Elliotte Rusty Harold</p> </footer> </body> </html> 现在不再需要 div 了。不再需要自己设置 class 属性,从标准的元素名就可以推断出各个部分的意义。 这对于音频浏览器、手机浏览器和其他非标准浏览器尤其重要。 回页首