How can I position my div at the bottom of its container?

前端 未结 24 2305
广开言路
广开言路 2020-11-22 00:46

Given the following HTML:



        
24条回答
  •  南笙
    南笙 (楼主)
    2020-11-22 01:39

    Don't wanna use "position:absolute" for sticky footer at bottom. Then you can do this way:

     html,
            body {
                height: 100%;
                margin: 0;
            }
            .wrapper {
                min-height: 100%;
                /* Equal to height of footer */
                /* But also accounting for potential margin-bottom of last child */
                margin-bottom: -50px;
            }
            .footer{
                background: #000;
                text-align: center;
                color: #fff;
            }
            .footer,
            .push {
                height: 50px;
            }
    
    
        
        
    content
    test

提交回复
热议问题