I am reading over HTML5 docs on W3C site now, and I just read this:
Note: 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.
So, I interpret that as "Do not style section elements. Use DIV instead." But I've seen a few websites that style all of the HTML5 elements, and guess what? I 'Viewed Source' of that W3C link below 开发者_Python百科where it says not to style a section element, and they styled it themselves! WTF? http://www.w3.org/TR/html5/sections.html#the-section-element
Or should I interpret the above statement as:
"You can style section elements, so long as the contents of the section element would be listed explicitely in the document's outline."?
The HTML5 spec does not state that you shouldn't apply CSS styles to the section
tag, but rather that you shouldn't include section
tags simply for styling/scripting purposes, as that affects the semantic layout of your document.
From the section about section
:
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. [emphasis added]
Compare to the section about div
:
div
elements can be useful for stylistic purposes or to wrap multiple paragraphs within a section that are all to be annotated in a similar way. [emphasis added]
精彩评论