Flexbox column align self to bottom

后端 未结 7 1417
逝去的感伤
逝去的感伤 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

    <div class="site-container">
        <header>your header</header>
        <main>your main with little content</main>
        <footer>your footer</footer>
    </div>
    

    CSS

    .site-container{
        min-height: 100vh;   //not necessary to calculate the height of the footer
        display: flex;
        flex-direction: column;
    }
    
    footer{
        margin-top: auto;
    }
    
    0 讨论(0)
提交回复
热议问题