回到顶部-锚点

<!DOCTYPE html>
<html>

<head>
  <style>
    * {
      margin: 0;
      padding: 0;
    }
    
    .content {
      width: 100%;
      height: 2000px;
      background-color: gray;
    }
    
    .dw {
      position: fixed;
      width: 100px;
      height: 100px;
      color: #fff;
      right: 50px;
      bottom: 100px;
      background-color: blueviolet;
      line-height: 100px;
      text-align: center;
    }
  </style>
</head>

<body>
  <div class="content" id="top">
    顶部
    <a href="#top">
      <div class="dw">回到顶部</div>
    </a>
  </div>
</body>

</html>

 

posted @ 2020-02-09 10:38  枚齐元子  阅读(235)  评论(0编辑  收藏  举报