zoukankan      html  css  js  c++  java
  • footer绝对定位但是不在页面最下边解决方案

    方案一

    html {
        height: 100%;
    }
    
    body {
        position: relative;
        min-height: 100%;
        box-sizing: border-box;
        padding-bottom: 80px; /* .footer 的高度,为 footer 占位 */
    }
    
    .footer {
        position: absolute;
        bottom: 0;
        left: 0;
         100%;
        height: 80px;
    }
    

    方案二

    <!doctype html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Document</title>
        <style type="text/css">
            html,body {
                height: 100%;
                margin: 0;
                padding: 0;
            }
    
            #container {
                min-height: 100%;
                height: auto !important;
                height: 100%;
            }
            #page {
                padding-bottom: 60px;/*高度等于footer的高度*/
            }
            #footer {
                position: relative;
                margin-top: -60px;/*等于footer的高度*/
                height: 60px;
                clear:both;
                background: red;
            }
    
            #header {
                padding: 10px;
                background: lime;
            }
            #left {
                 18%;
                float: left;
                margin-right: 2%;
                background: blue;
            }
            #content{
                 60%;
                float: left;
                margin-right: 2%;
                background: green;
            }
            #right {
                 18%;
                float: left;
                background: blue;
            }
        </style>
    </head>
    <body>
    <div id="container">
        <div id="header">Header</div>
        <div id="page" class="clearfix">
            <div id="left">Left sidebar</div>
            <div id="content">Main contentMain contentMain contentMain contentMain contentMain contentMain contentMain contentMain contentMain content Lorem ipsum dolor sit amet, consectetur adipisicing elit. Accusamus animi blanditiis, consequuntur dolorem ea eos magnam necessitatibus numquam, quaerat quia quod rem sint unde. Deserunt dolorum laboriosam minus repellat veniam! Lorem ipsum dolor sit amet, consectetur adipisicing elit. Accusantium, adipisci architecto, blanditiis cumque doloremque, ea earum et maxime non pariatur quas quia quibusdam recusandae similique sit soluta tempora voluptas voluptate. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ad autem ea impedit ut vel. Aut culpa exercitationem incidunt itaque non, nulla saepe voluptas. Inventore, molestiae perferendis provident quaerat ullam veniam.
             pisicing elit. Accusamus cupiditate facilis fugit inventore iste itaque iusto modi, natus nobis numquam obcaecati odio odit optio ratione sit ullam veniam vero. Vero.
           </div>
            </div>
    </div>
    <div id="footer">Footer </div>
    </body>
    </html>
    

      

      

  • 相关阅读:
    (转)JVM参数的说明、简单记法和GC调优策略
    深度学习论文翻译解析(十二):Fast R-CNN
    深度学习论文翻译解析(十一):OverFeat: Integrated Recognition, Localization and Detection using Convolutional Networks
    vue中组建的创建和使用
    CountDownLatch的理解和使用
    java多线程并发编程中对一些概念和关键字的理解
    spring中访问变量的用法
    mysql中group by优化
    vue中实现标题的国际化
    mysql中的覆盖索引,二级索引和索引排序
  • 原文地址:https://www.cnblogs.com/yanaweb/p/5632667.html
Copyright © 2011-2022 走看看