html5知识点补充—section元素的使用
文章目录
使用section元素对内容分组
section元素是一个总是需要标题的内容区域或页面区域。可以用它将多个部分的内容组合在一起,也可以根据需求,将内容的某一部分进一步划分。它不可用作通用封装器来实现样式上的需求。section元素中可以包含article元素,并且article元素也可以将其内容分割为section。
<section>
<h1>Sports News</h1>
<p>we'll put sports news here</p>
</section>
<section>
<h1>Entertainment News</h1>
<p>Entertainment news will go here.</p>
</section>
<section>
<h2>Nerdy News</h2>
<p>news for nerds will go in this section of the page.</p>
</section>
article和section的选择
目前来看,section元素的使用方式和div标记的使用方式很相似。不过,与div 不一样的是section具有语义含义,它是一组相关内容的组合。
section中可以包含article。假设有一个新闻页面,它可能有一个新闻版块,而在该板块中又有不同类别的新闻。

评论
登录后参与技术讨论,分享你的经验与见解。
登录 / 注册暂无评论