Flexbox column align self to bottom

后端 未结 7 1419
逝去的感伤
逝去的感伤 2021-01-30 19:53

Im trying to use Flexbox. http://css-tricks.com/almanac/properties/a/align-content/ this shows nice alignment options; but i would actually want a Top-top-bottom situation.

7条回答
  •  遥遥无期
    2021-01-30 20:24

    Considering that your website has a basic structure, here's a solution that I used and applied in a similar situation, with just a few lines of code:

    HTML

    your header
    your main with little content
    your footer

    CSS

    .site-container{
        min-height: 100vh;   //not necessary to calculate the height of the footer
        display: flex;
        flex-direction: column;
    }
    
    footer{
        margin-top: auto;
    }
    

提交回复
热议问题