How to create a sticky footer in CSS inside an absolutely positioned div?

前端 未结 3 1387
小鲜肉
小鲜肉 2021-01-25 17:12

I would like to create a sticky footer inside an absolutely positioned div element.

My approach was to position the footer div absolutely as well - inside an ad

3条回答
  •  北荒
    北荒 (楼主)
    2021-01-25 17:44

    change CSS

        .page{height: 100%;}
      .page-inner {
        margin-bottom:-30px;
        min-height: 100%;
    
    
      }
      .page-inner:after{height:30px;
      content: "";
      display: block;
    }
      .footer {
        height: 30px;
        color: brown;
        border: 1px solid brown;
      }
    

    https://jsfiddle.net/8nrukse9/5/

提交回复
热议问题