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 表示一段專題性的內(nèi)容,一般會帶有標(biāo)題??吹竭@里,我們也許會想到,那么一篇博客文章,或者一條單獨(dú)的評論豈不是正好可以用 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.”
“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 不僅僅是一個普通的容器標(biāo)簽。當(dāng)一個標(biāo)簽只是為了樣式化或者方便腳本使用時,應(yīng)該使用 div 。一般來說,當(dāng)元素內(nèi)容明確地出現(xiàn)在文檔大綱中時,section 就是適用的。
Apples
Tasty, delicious fruit!
The apple is the pomaceous fruit of the apple tree.
Red Delicious
These bright red apples are the most common found in many supermarkets.
Granny Smith
These juicy, green apples make a great filling for apple pies.
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.”
“In case of conflict, consider users over authors over implementors over specifiers over theoretical purity.” 一旦遇到?jīng)_突,最終用戶優(yōu)先,其次是作者,其次是實現(xiàn)者,其次標(biāo)準(zhǔn)制定者,***才是理論上的完滿。