- <!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>
来源: http://www.bubuko.com/infodetail-3412671.html