HTML5新增标签的使用

HTML5新增的标签


  1、<article>  标记定义一篇文章

 2、<header>  标记定义一个页面或一个区域的头部

 3、 <nav>   标记定义导航链接

 4、<section>  标记定义一个区域

 5、<aside>  标记定义页面内容部分的侧边栏

 6、<footer>  标记定义一个页面或一个区域的底部


具体使用如下:

<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
    <link type="text/css" rel="stylesheet" href="css/my1.css"/>
</head>
<body>

<!-- 用标签来简化代码 [HTML5+CSS3] -->
  <div class="box">
    <!-- 头部-->
      <header>
        LOG
      </header>
     <!-- 导航-->
      <nav>
           【导航】
          <a href="#">张三</a>
          <a href="#">李四</a>
          <a href="#">王五</a>
      </nav>

      <!--定义一个区域  -->
      <section>
          section
          <!--定义一篇文章-->
          <article> article</article>
          <!--定义区域头部-->
          <header> header</header>
          <p>..pp....</p>
          <!--定义区域底部 -->
          <footer>footer</footer>
      </section>
      <!--定义区域侧边栏 -->
      <aside>
          aside
      </aside>
      <!--定义区域底部 -->
      <footer>footer</footer>
  </div>

</body>
</html>


样式文件:my1.css

*{
    margin: 0px;
    padding: 0px;  /* 内,外边距去掉*/

}

a{
    text-decoration: none;
    color:#FFF;
}
.box{
    width: 800px;
    margin: 0px auto;  /* 水平居中*/
}
header{
    width: 800px;
    height: 50px;
    font-size: 24px;
    text-align: center;
    background: #a7acaf;
}

nav{
    width: 800px;
    height: 45px;
    font-size: 24px;
    text-align: center;
    color: #FFF;
    background:#124c9b;
}
section {
    width: 400px;
    height: 400px;
    background: #c81623;
    text-align: center;
    /* 左浮动*/
    float: left;

}

section article{
    width: 390px;
    height: 80px;
    margin: 0px auto;
    background: greenyellow;
    text-align: center;
}
section header{
    width: 390px;
    height: 50px;
    margin: 0px auto;
    background: bisque;
    text-align: center;
}
section p{
    width: 390px;
    height: 200px;
    margin: 0px auto;
    background:fuchsia;
    text-align: center;
}

section footer{
    width: 390px;
    height: 50px;
    margin: 0px auto;
    background:lightcoral;
    line-height: 50px;
}

aside {
    width: 400px;
    height: 400px;
    font-size:24px;
    text-align: center;
    background:goldenrod;
    /* 左浮动*/
    float: left;

}

footer{
    width: 800px;
    height: 80px;
    font-size: 24px;
    text-align: center;
    background:mediumaquamarine;
    margin: 0px auto;
    /*清除浮动  */
    clear: both;
    line-height: 80px;
}

显示效果:






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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值