What is the exact difference between <div> and <section>? Like I know Section has 'meaning' and div doesn't, but what does that mean?
本问题已经有最佳答案,请猛点这里访问。
我的意思是,根据我的研究,我知道这和一样,只是这个部分有意义,而DIV没有意义,这到底意味着什么?与使用DIV时相比,在浏览器上使用节输出它会有不同吗?我只是想想象一下两者之间的区别。请不要给我任何google的答案,因为我已经在google上搜索了,但仍然不完全理解它。它仅仅是为了可读性吗?谢谢
W3维基上有一个很好的解释:
The
element represents a generic section of a document or
application.
- A section, in this context, is a thematic grouping of content:
- chapter
- various tabbed pages in a tabbed dialog box
- 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. The section element is appropriate
only if the contents would be listed explicitly in the document's
outline. [Example A]- A section typically with a heading.
http://www.w3.org/tr/html markup/terminology.html流内容
它们在输出方面不会有任何区别,在divs上使用节的目的是增加代码中的语义值,或者换句话说,当您或其他人返回并试图理解它的作用时,使其更具可读性。