• 1.Sticky-footer-常规布局方法


    <!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>Sticky footer布局</title>
      <style>
        * {
          margin: 0;
          padding: 0;
        }
        html,
        body {
          height: 100%;
         
        }
        body>.wrap {
          min-height: 100%;
        }
        .content {
          /* padding-bottom 等于 footer 的高度 */
          padding-bottom: 60px;
          background: #eee;
        }
        .footer {
          width: 100%;
          height: 60px;
          /* margin-top 为 footer 高度的负值 */
          margin-top: -60px;
          background: red;
        }
      </style>
    </head>
    
    <body>
      <!-- 我们所见到的大部分网站页面,都会把一个页面分为头部区块、内容区块和页脚区块,当头部区块和内容区块内容较少时,页脚能固定在屏幕的底部,而非随着文档流排布。当页面内容较多时,页脚能随着文档流自动撑开,显示在页面的最底部,这就是Sticky footer布局。 -->
      <div class="wrap">
        <div class="content">
          <h2>Sticky footer布局?</h2>
          <hr>
          <hr>
          <p>我们所见到的大部分网站页面,都会把一个页面分为头部区块、内容区块和页脚区块,当头部区块和内容区块内容较少时,页脚能固定在屏幕的底部,而非随着文档流排布。当页面内容较多时,页脚能随着文档流自动撑开,显示在页面的最底部,这就是Sticky footer布局。</p>
          <hr>
          <p>无限增加内容。。。。</p>
          
        </div>
      </div>
      <div class="footer">
        <p>这是页脚</p>
      </div>
    
    </body>
    
    </html>
  • 相关阅读:
    自己设计大学排名-数据库实践
    自己设计大学排名-数据库实践
    自己设计大学排名-数据库实践
    自己的第一个网页
    类和正则表达(自动更正,和代数运算)
    第一个爬虫和测试
    第一个爬虫和测试
    科学计算和可视化
    数据库分表后如何处理事务问题
    jquery下滑到一定高度后,顶部固定
  • 原文地址:https://www.cnblogs.com/xzma/p/8522125.html
Copyright © 2020-2023  润新知