内部 div 和节或文章等语义元素之间有什么区别?
What is the difference between internally div and semantic elements like section or article etc..?
div
的内部和 section
或 article
等语义元素之间有什么区别?
我发现内部div
也有display: block;
并且语义元素也有(section
、article
等)display: block;
,所以内部CSS 都是相同的,所以语义只是为了有意义地呈现 HTML 代码,或者是否还有其他内部行为?
我知道 div
元素没有意义,但语义元素有有意义的名称。
查看 http://html5doctor.com/the-section-element/ 他们给出了 html5 的清晰指南。
section is a blob of content that you could store as an individual record in a database.
It generally looks like this (and note that the heading goes inside the section element, not immediately before it):
<body>
...
<section>
<h2>level of heading = section nesting level</h2>
rest of the content
</section>
...
</body>
我完全支持@TFFX 的回答,我只是想补充另一个方面,即盲人屏幕阅读器。他们的工作方式是,他们不仅阅读内容(这是看到用户通常会看到的唯一内容),而且他们还阅读 body-tag 内的 HTML-tags。所以对于盲人来说,当使用不同的标签时,更容易理解网页。
div
的内部和 section
或 article
等语义元素之间有什么区别?
我发现内部div
也有display: block;
并且语义元素也有(section
、article
等)display: block;
,所以内部CSS 都是相同的,所以语义只是为了有意义地呈现 HTML 代码,或者是否还有其他内部行为?
我知道 div
元素没有意义,但语义元素有有意义的名称。
查看 http://html5doctor.com/the-section-element/ 他们给出了 html5 的清晰指南。
section is a blob of content that you could store as an individual record in a database. It generally looks like this (and note that the heading goes inside the section element, not immediately before it):
<body>
...
<section>
<h2>level of heading = section nesting level</h2>
rest of the content
</section>
...
</body>
我完全支持@TFFX 的回答,我只是想补充另一个方面,即盲人屏幕阅读器。他们的工作方式是,他们不仅阅读内容(这是看到用户通常会看到的唯一内容),而且他们还阅读 body-tag 内的 HTML-tags。所以对于盲人来说,当使用不同的标签时,更容易理解网页。