html中div标签和section标签之间的区别及其用法

编程入门 行业动态 更新时间:2024-10-24 08:29:38
本文介绍了html中div标签和section标签之间的区别及其用法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

html中div标签和section标签之间的区别以及它们与示例一起使用哪个更好用,以及为什么

Difference between div tag and section tag in html and their use with examples and which is better to use and why

推荐答案

这是规范说的: http://www.w3。 org / html / wg / drafts / html / master / semantics.html#the-section-element [ ^ ] 我的意见是它更多关于页面的语义方面。例如,当您有报纸网站或博客时,您已经严格定义了布局。而不是使用 Here is what spec says: www.w3/html/wg/drafts/html/master/semantics.html#the-section-element[^] My opinion is that it is more about semantic side of your page. When you for example have a newspaper website or blog, you have strictly defined layout. And instead of using

,您将使用article标签。但是没有人强迫你去做。你的页面与div和文章的工作方式完全相同。 所以我说这更多是关于语义的,也许将来搜索引擎会给你一些加点使用这个,也许不是:)。 这里也是关于这个话题的非常好的文章: html5doctor/the-section-element/ [ ^ ] 如果你不想读它所有最好的部分是我认为: 使用部分的经验法则 当然,总有例外,但这些应该为99%的案例提供有用的指导: Don'使用它作为造型或脚本的钩子;这是一个div 不要使用它,如果文章,旁边或导航更合适 不要使用它,除非在该部分的开头自然有一个标题 修订后的规范(截至9月16日)说: 鼓励作者使用article元素而不是section元素,因为联合内容是有意义的元素。 由于博客文章和评论通常是联合的(通过被拉入其他博客或通过twitter,reddit等链接),它们应该是文章。

you will use article tag. But nobody forces you to do it. You page will work exactly the same with div and with article. So as I said it is more about semantic and maybe in a future the search engines will give you some plus points for using this and maybe not :). here is a very good article about this topic too: html5doctor/the-section-element/[^] if you dont want to read it all best part is I think this: Rules of thumb for using section Of course, there are always exceptions, but these should give useful guidance for 99% of cases: Don't use it just as hook for styling or scripting; that's a div Don't use it if article, aside or nav is more appropriate Don't use it unless there is naturally a heading at the start of the section The revised spec (as of 16 September) says: 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. As blogposts and comments are often syndicated (by being pulled into other blogs or being linked via twitter, reddit etc) they should be articles.

更多推荐

html中div标签和section标签之间的区别及其用法

本文发布于:2023-11-13 00:57:20,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1582972.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:标签   区别   html   div   section

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!