关于格式化:HTML部分与div和差异

HTML section vs div and differences

本问题已经有最佳答案,请猛点这里访问。

分区和分区之间有什么区别?两种用法相同:

1
2
 Element1
<section id='test'> Element2 </section>

但是为什么呢?

第二个问题:我需要设计一个主页…内容页应该像这样…有不同的部分……我该拿什么……分区还是分区?


从这里:

The section element represents a generic document or application
section…The section element is not a generic container element. When
an element is needed only for styling purposes or as a convenience for
scripting, authors are encouraged to use the div element instead. section is a blob of content that you could store as an individual record in a database.

是一个通用的div流容器。这是一个块级元素和没有额外的语义含义。


新的一天是节到HTML5的浏览器可能是有效的,但有均值故障它。根据MDN

?Do not use the element as a generic container; this is what is for, especially when the sectioning is only for styling purposes. A rule of thumb is that a section should logically appear in the outline of a document.


div

The div element has no special meaning at all. It represents its
children. It can be used with the class, lang, and title attributes to
mark up semantics common to a group of consecutive elements.

点击这里了解更多关于div

部分:

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.

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.

点击这里了解更多关于截面


div是块级元素是作为一个容器部分和使用的语义标签,但在HTML5是一个更好的方式来表达更多的HTML内容。