html里的section可以设置id,如何正确使用HTML5中的“section”标签?

答案是在目前的规格:

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.

Authors are encouraged to use the article element instead of the

section element when it would make sense to syndicate the contents of

the element.

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.

参考:

另见:

看起来这个元素的目的有很多混乱,但是一致同意的是,它不是一个通用的包装器,如< div>是。它应该用于语义目的,而不是CSS或JavaScript钩子(虽然它当然可以样式或“脚本”)。

一个更好的例子,从我的理解,可能看起来像这样:

How to use the section tag

Disclaimer

Don't take my word for it...

Examples

But here's how I would do it...

Closing Notes

Well that was fun. I wonder if the spec will change next week?

请注意,完全非语义的< div>可以在HTML规范允许的文档中的任何位置使用,但不是必需的。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值