Bootstrap 4.0 - responsive header with image + navbar + full-height body

后端 未结 1 2014
失恋的感觉
失恋的感觉 2021-01-28 06:36

I am building a responsive page with bootstrap 4 which has a heading/title section with an image of the client\'s logo, their name and a navbar. All these elements are responsiv

相关标签:
1条回答
  • 2021-01-28 06:58

    Instead of setting defined heights, use flexbox to make the content area fill the height of it's parent container (which in this case is the body).

    body {
        display:flex;
        flex-direction:column;
    }
    
    .flex-fill {
        flex: 1 1 auto;
    }
    
    .flex-shrink {
        flex-shrink: 0;
    }
    

    https://www.codeply.com/go/fKNRvG0Hak

    Note: The flex-fill utility class will be included in the next Bootstrap 4 release: https://github.com/twbs/bootstrap/commit/2137d61eacbd962ea41e16a492da8b1d1597d3d9


    Similar questions:
    Make a nested row fill its parent that has been made to fill viewport height using flex-grow in Bootstrap 4?
    Bootstrap 4 Navbar and content fill height flexbox
    Bootstrap 4 page wide header bar above navbar

    0 讨论(0)
提交回复
热议问题