HTML5 中 div section article 的区别
HTML5 中 div section article 的区别
刚刚开始接触 HTML5 时,对它的标签很不适应,甚至一度有点反感。尤其是对 div、section、article 这几个标签,实在弄不清楚应该使用在什么场合下。 div
HTML Spec: “The div element has no special meaning at all.”
这个标签是我们见得最多、用得最多的一个标签。本身没有任何语义,用作布局以及样式化或脚本的钩子(hook)。
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.”
section 应用的典型场景有文章的章节、标签对话框中的标签页、或者论文中有编号的部分。一个网站的主页可以分成简介、新闻和联系信息等几部分。其实我对这里传达信息很感兴趣,因为感觉 section 和下面要介绍的 artilce 更加适用于模块化应用,这个话题以后会出篇专门的文章来讨论,这里暂时略过。 要注意,W3C 还警告说:
div section article的区别与应用_计算机软件及应用_IT/计算机_专业资料。详细...HTML Spec 中接着又列举了一些 article 适用的场景。 当 article 内嵌 article...
下面是 HTML5 的解决方案实例: <section> <section> <article> <header> <h1>Div Soup Demonstration</h1> <p>Posted on July 11th, 2009</p> </...
HTML5 中 div section article 的区别 http://www.xinran001.com/bbs/thread-71743-1-10.html 17、22 个 HTML5 的初级技巧 http://www.xinran001.com/bbs...
? HTML5:<article></article> ? HTML4:<div></div> ? ? <aside>标签...标签用于对网页或区段(section)的标题进行组合。 ? HTML5: ?<hgroup></h...
(http://www.panlongit.com/) )在开发网站时,你不在需要用<div>标记来...4.新的<section>和<article>标记 跟<header>和<footer>标记类似,HTML5中引入...
div> </body> </html> 使用这种方法引用要确保 CSS 文件和 HTML 文件的相对...新的特殊内容元素,比如 article、footer、header、nav、section 5. 新的表单控件...
HTML5中div section article的区别 CSS模块化编码 让开发事半功倍 解决IE8.0下DIV+CSS网站不居中问题 解析CSS+DIV在IE6和IE7中的区别 双剑合璧 PHP+MySQL的最...
相似而 www.7yue.com www.weibo.com/7yue HTML5 sectioning+CSS3 , 页面 3 主题不同的文章,比如时装section部分,有5篇article,结构大体一 致,内容上却不同...
■HTML5 的结构 ? ? ? ? ? section:这可以是...指向其他页面的一组链接 article:blog、杂志、文章...div 元素来表示 HTML 5 增加的块级元素:除了结构...
HTML5中代码示例: <section>…</section> HTML4中代码示例: <div>…</div> article元素 article元素表示页面中的一块与上下文不相关的独立内容,譬如博客中的...
热门文档