XHTML/HTML5 页面的哪些元素应明确包含在文档大纲中?
section 元素表示通用文档或应用程序部分。在这种情况下,节是内容的主题分组,通常带有标题。
...
注意:节元素不是通用容器元素。当出于样式目的或方便编写脚本而需要元素时,鼓励作者改用 div 元素。 一般规则是,仅当元素的内容在文档大纲中明确列出时,section 元素才适用。
大纲中应明确列出哪些内容?我不知道大纲到底是在何时或如何使用的,所以我很难猜测。
页面导航是否应该包含在大纲中?与切线相关的内容(如旁白)?或者只是页面的主要内容?
The HTML5 spec definition of the "section" element is:
The section element represents a generic document or application section. A section, in this context, is a thematic grouping of content, typically with a heading.
...
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.
What content should be explicitly listed in the outline? I don't know exactly when or how the outline is used, so it's difficult for me to guess.
Should page navigation be included in the outline? Tangentially-related content (like asides)? Or just the main content of a page?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
与许多标记一样 - 涉及一定程度的个人偏好。由于大纲最常用于创建目录,因此这是衡量大纲中应包含的内容的最简单方法。与Word文档进行比较。您希望在目录中看到旁白的标题吗?有时是,有时不是。只有您可以判断它是否适合您的页面。
Like a lot of markup - there's a degree of personal preference involved. Since an outline is most often used to create a Table of Contents, that's the easiest way to measure what should be included in a outline. Compare with a Word document. Would you expect to see the header of an aside in the table of contents? Sometimes yes, sometimes no. Only you can judge whether it's appropriate for your page.