html - <aside>侧边栏中<section>和<div>的区别

标签 html sidebar semantic-markup

<分区>

我发现有两种标记侧边栏的方法:

<aside id="sidebar">
    <section id="widget_1"></section>
    <section id="widget_2"></section>
    <section id="widget_3"></section>
</aside>

<aside id="sidebar">
     <div class="widget" id="widget_1"></div>
     <div class="widget" id="widget_2"></div>
     <div class="widget" id="widget_3"></div>
 </aside>

请告诉我这两种方法有什么区别,必须使用哪一种?

最佳答案

部分通常指定相关的信息组 - 而 div 标签并没有真正指定任何内容,通常用作子元素:)

如果你想阅读更多,你可以查看this answer我认为这很好地涵盖了它。

要回答您的问题,两种方法都行得通 - 这更像是一种风格选择,以及您希望如何组织网站上的信息。

关于html - <aside>侧边栏中<section>和<div>的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39232773/

相关文章:

php - 使用ajax上传文件和插入数据

css - 如何为浏览器插件创建侧边栏

html - 扩展 html5 微数据事件模式

html - 这对 article 元素有用吗?

html - 响应式设计 : Elements with fixed size & fixed position relative to each other. 文字环绕

html - 如何从mvc中的另一个目录打开html文件

php - 如何根据月份并排显示两个html表格中的日期?

css - 为什么隐藏侧边栏的元素?

php - 如何更改小部件菜单容器

html - <b> 与 HTML5 中的 <span>