[tr][td] 由于缺少结构,即使是形式良好的 HTML 页面也比较难以处理。必须分析标题的级别,才能看出各个部分的划分方式。边栏、页脚、页眉、导航条、主内容区和各篇文章都由通用的 div 元素来表示。HTML 5添加了一些新元素,专门用来标识这些常见的结构:
· section:这可以是书中的一章或一节,实际上可以是在 HTML 4 中有自己的标题的任何东西 · header:页面上显示的页眉;与 head 元素不一样 · footer:页脚;可以显示电子邮件中的签名 ·nav:指向其他页面的一组链接 · article:blog、杂志、文章汇编等中的一篇文章 我们来考虑一个典型的 blog主页,它的顶部有页眉,底部有页脚,还有几篇文章、一个导航区和一个边栏,见代码1 典型的 blog 页面 Mokka mit Schlag <divid="page"> Mokka mitSchlag <divid="container"> <divclass="post" id="post-1000572"> "/blog/birding/2007/04/23/spring-comes-and-goes-in-sussex-county/"> SpringComes (and Goes) in Sussex County <divclass="entry"> Yesterday I joined the Brooklyn Bird Club forour annual trip to Western New Jersey, specifically Hyper Humus, arelatively recently discovered hot spot. It started out as a nice wintermorning when we arrived at the site at 7:30 A.M., progressed to Springaround 10:00 A.M., and reached early summer by 10:15. "/blog/birding/2007/04/23/but-does-it-count-for-your-life-list/"> But does it count for your life list? <divclass="entry"> Seems you can now gohref="http://www.wired.com/science/discoveries/news/ 2007/04/cone_sf">birdwatching 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'timagine it replacing actually being out in the field by any smallamount. On the other hand, I've always found it quite sad to meet seniorbirders 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 elderlybirder did a big year on TV, after he could no longer get out so much. Thiscertainly topsthat. <divclass="navigation"> « _fcksavedurl=""/blog/page/2/">«" PreviousEntries <divclass="alignright"> <divid="right" class="column"> <ulid="sidebar"> Info [*]CommentPolicy [*]TodoList Archives [*]April 2007 [*]March 2007 [*]February 2007 [*]January2007 </ul> <divid="footer"> Copyright 2007 Elliotte RustyHarold 即使有正确的缩进,这些嵌套的div 仍然让人觉得非常混乱。在 HTML 5 中,可以将这些元素替换为语义性的元素,见代码2 用HTML5编写的典型blog页面 Mokka mitSchlag Mokka mitSchlag "/blog/birding/2007/04/23/spring-comes-and-goes-in-sussex-county/"> SpringComes (and Goes) in Sussex County Yesterday Ijoined 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 at7:30 A.M., progressed to Spring around 10:00 A.M., and reached early summerby 10:15. "/blog/birding/2007/04/23/but-does-it-count-for-your-life-list/"> Butdoes it count for your life list? Seems you cannow gohref="http://www.wired.com/science/discoveries/news/ 2007/04/cone_sf">birdwatching 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'timagine it replacing actually being out in the field by any smallamount. On the other hand, I've always found it quite sad to meet seniorbirders 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 elderlybirder did a big year on TV, after he could no longer get out so much. Thiscertainly tops that. « _fcksavedurl=""/blog/page/2/">«" PreviousEntries [*]Info [*]CommentPolicy [*]TodoList [*]Archives [*]April 2007 [*]March 2007 [*]February 2007 [*]January2007 Copyright2007 Elliotte RustyHarold 现在不再需要 div 了。不再需要自己设置 class 属性,从标准的元素名就可以推断出各个部分的意义。这对于音频浏览器、手机浏览器和其他非标准浏览器尤其重要。[/td][/tr] |
|