HTML5标签变化-结构标签

结构标签
结构标签:可以理解为有意义的div
<article></article> 标记定义一篇文章
<header></header> 标记定义一个页面或一个区域的头部
<nav></nav> 标记定义导航链接
<section></section> 标记定义一个区域
<aside></aside> 标记定义页面内容部分的侧边栏
<hgroup></hgroup> 标记定义文件中一个区块的相关信息
hgroup使用:

  <hgroup>
    <h1>标题</h1>
    <h2>二级标题</h2>
  </hgroup>

<figure></figure> 标记定义一组媒体内容以及他们的标题
figure使用:

  <figure>
    <img src="" alt="">
    <figcaption>图片标题</figcaption>
  </figure>

<footer></footer> 标记定义一个页面或一个区域的底部
<dialog></dialog> 标记定义一个对话框


结构标签的具体使用

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <style>
    footer {
      height: 50px;
      background-color: #abcdef;
      line-height: 50px;
      text-align: center;
      font-size: 24px;
      font-weight: bold;
      color: #696969;
    }
  </style>
</head>
<body>
  <header>
    <div>Logo</div>
    <nav>
      <a href="">首页</a>
      <a href="">介绍</a>
      <a href="">案例</a>
      <a href="">链接</a>
      <a href="">关于</a>
    </nav>
  </header>
  <section>
    <hgroup>
      <h1>title</h1>
      <h3>author</h3>
      <h4>date</h4>
    </hgroup>
    <aside>
      <a href="#se1">section one</a>
      <a href="#se2">section two</a>
      <a href="#se3">section three</a>
    </aside>
    <article>
      <p>
          Lorem ipsum dolor sit amet, consectetur adipisicing elit. Fugiat odit nesciunt molestiae expedita, dicta in veniam quidem voluptate alias perspiciatis quod doloremque libero. Quasi, aut impedit? Aliquid blanditiis maiores voluptatibus.
      </p>
    </article>
  </section>
  <section>
    <figure>
      <div class="video"></div>
      <figcaption>视频标题</figcaption>
    </figure>
  </section>
  <section>
    <dialog>
      <dt>张三:内容还不错</dt>
      <dd>李四:还好吧,就是主题不突出</dd>
    </dialog>
    <dialog>
      <dt>张三:内容还不错</dt>
      <dd>李四:还好吧,就是主题不突出</dd>
    </dialog>
  </section>
  <footer>
    copyright
  </footer>
</body>
</html>

结构标签的补充点

  1. header/section/aside/article/footer 不要自己嵌套自己
    例如:
<header>
  <header></header>
</header>

是不合适的。

  1. 嵌套级别:header/section/footer 大于 aside/article/figure/hgroup/nav
<article>
  <header></header>
</article>

这样的也是不合适的。

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • HTML5 标签comment 注释标签用于在源文档中插入注释。注释内容不会被浏览器显示。为代码编写注释的好处是...
    才気莮孒阅读 9,537评论 1 25
  • 1.结构标签2.多媒体标签3.web应用标签4.其他标签 ●结构标签 结构标签(块状元素)——有意义的div 标记...
    越IT阅读 3,474评论 0 0
  • HTML 5的革新之一:语义化标签一节元素标签。 html5的布局 节点元素标签分为:节元素标签、文本元素标签、分...
    Bookish倩宝阅读 3,570评论 0 2
  • 在HTML 5出来之前,我们用div来表示页面章节,但是这些div都没有实际意义。(即使我们用css样式的id和c...
    浪漫歌阅读 2,939评论 0 0
  • 今天怎么了,昨天晚上睡觉前在床上坐了一个小时,等到睡觉时,屁股就特别疼,索性看回电视,再睡觉,缓解一下疼痛。 想着...
    心情小屋阅读 1,020评论 0 0