是否需要有标题?在 HTML5 中
HTML5 中是否有必要有一个 标题,就像这里提到的 http://blog.whatwg.org/is-not-just-a-semantic
有时,在页面上我们有一些相关的元素,可以组合在 <部分 id="语义name">
而不是
但我们没有任何标题..可以使用 ;
内没有 、
、
Is it necessary to have a heading of <section>
in HTML5 like mentioned here http://blog.whatwg.org/is-not-just-a-semantic
Sometime on a page we have some elements which are related and can be combined in a <section id="semantic name">
instead <div id="semantic name">
But we don't have any Heading for that..
Is it OK to use <section>
without having <h1>
, <h2>
, <h3>
inside
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
根据 HTML5 Doctor,您不应使用
如果没有自然标题。此外,他们还说:
另外,查看这个漂亮的流程图来决定什么元素最好在您的情况下使用。
According to the HTML5 Doctor, you should not use
<section>
if there is no natural heading for it. Also, they say:Also, check out this nifty flowchart to decide what element is best to use in your situations.
不,这不是必需的。
您可以通过阅读 轻松检查这一点定义
section
元素(“应该”不是“必须”)或通过验证您的 HTML。当没有使用标题时,W3C 验证器将报告警告,但警告并不是错误。
No, it is not required.
You can easily check this by reading the definition of the
section
element ("should" is not "must") or by validating your HTML.The W3C validator will report a warning when no heading is used, but a warning is not an error.
仅当它不会时才需要 [validate] (http://validator.w3.org)
节标签的使用是为了传达内容的结构,就像一本书被分成章节、段落等
如果您的页面是混搭的使图像看起来像杂志封面,您可能不需要添加任何部分。您很可能仍然需要导航结构,但这不是使用部分来完成的。
我想说任何包含文本块的页面(大多数页面)都应该使用节标签而不是 div。保留 div 仅用于控制布局。
我最好的建议是查看您的网站在纯文本浏览器或其他可访问客户端中的外观。令人惊讶的是,大多数网站的可访问性设计都是如此垃圾。我的看法是,部分标签是改进这一点的尝试。
Its only necessary if it wont [validate] (http://validator.w3.org)
The use of section tags is to convey the structure of your content, like a book is split into chapters, paragraphs, etc
If your page is mash of images to look like a magazine cover you may not have a need for adding any sections. You'll most likely still want structure for navigation but that's not done using sections.
I would say any page containing chunks of text (most pages) should use a section tag rather than a div. keep the divs for controlling layout only.
My best advice is to see how your site looks in a text only browser, or other accessible client. It amazing how rubbish most sites are designed for accessibility. My take is that section tags are an attempt to improve that.