section HTML Spec: The section element represents a generic section of a document or application. A section, in this context, is a thematic grouping of content, typically with a heading.
与 div 的无语义相对,简单地说 section 就是带有语义的 div 了,但是千万不要觉得真得这么简单。section 表示一段专题性的内容,一般会带有标题。看到这里,我们也许会想到,那么一篇博客文章,或者一条单独的评论岂不是正好可以用 section 吗?接着看:
Authors are encouraged to use the article element instead of the section element when it would make sense to syndicate the contents of the elemen.
当元素内容聚合起来更加言之有物时,应该使用 article 来替换 section 。
那么,section 应该什么时候用呢?再接着看:
Examples of sections would be chapters, the various tabbed pages in a tabbed dialog box, or the numbered sections of a thesis. A Web site s home page could be split into sections for an introduction, news items, and contact information.
The section element is not a generic container element. When an element is needed for styling purposes or as a convenience for scripting, authors are encouraged to use the div element instead. A general rule is that the section element is appropriate only if the element s contents would be listed explicitly in the document s outline.
section 不仅仅是一个普通的容器标签。当一个标签只是为了样式化或者方便脚本使用时,应该使用 div 。一般来说,当元素内容明确地出现在文档大纲中时,section 就是适用的。
article HTML Spec: The article element represents a self-contained composition in a document, page, application, or site and that is, in principle, independently distributable or reusable, e.g. in syndication.
HTML Spec 中接着又列举了一些 article 适用的场景。 This could be a forum post, a magazine or newspaper article, a blog entry, a user-submitted comment, an interactive widget or gadget, or any other independent item of content.
复制代码代码如下: !DOCTYPE html html lang="en" head meta charset="utf-8" title 初学html5 /title !--meta tags-- meta name="keywords" content="" meta name="description" content="" !--stylesheets-- link rel="stylesheet" href="css/common.css" type="text/css" link rel="stylesheet" href="css/layout.css" type="text/css" link rel="stylesheet" href="css/reset.css" type="text/css" !--javascript-- script src="js/jquery-1.3.2.min.js" /script !--conditional comments-- !--[if IE] script src="js/html5.js" /script ![endif]-- /head body div id="container" header id="page-header" div id="logo" a href="/" img src="images/graphic-logo.gif" alt="mylogo" /a /div nav id="main-navigation" ul li a href="#" 首页 /a /li li a href="#" 关于 /a /li li a href="#" 服务 /a /li li a href="#" 信息 /a /li li a href="#" 联系 /a /li