Complete the code to make the footer stick to the bottom of the page using Bootstrap classes.
<body class="d-flex flex-column min-vh-100"> <main class="flex-shrink-0"> <div class="container"> <h1>Welcome</h1> <p>Content goes here.</p> </div> </main> <footer class="bg-light text-center text-lg-start [1]"> <div class="text-center p-3">Ā© 2024 Company</div> </footer> </body>
The mt-auto class adds automatic top margin to the footer, pushing it to the bottom inside a flex column container.
Complete the code to ensure the main content area shrinks properly to allow the footer to stay at the bottom.
<body class="d-flex flex-column min-vh-100"> <main class="[1]"> <div class="container"> <h1>Page Title</h1> <p>Some content here.</p> </div> </main> <footer class="bg-light text-center mt-auto"> <div class="p-3">Footer content</div> </footer> </body>
The flex-grow-1 class allows the main content to grow and fill available space, ensuring the footer stays at the bottom.
Fix the error in the footer class to correctly stick it to the bottom inside a flex column layout.
<footer class="bg-dark text-white text-center [1]"> <div class="p-4">Sticky footer content</div> </footer>
The mt-auto class pushes the footer to the bottom inside a flex column container, unlike fixed positioning which overlays content.
Fill both blanks to create a flex column layout with minimum viewport height and a footer that stays at the bottom.
<body class="[1]"> <main class="[2]"> <div class="container"> <h2>Content</h2> <p>Example text.</p> </div> </main> <footer class="bg-secondary text-white text-center mt-auto p-3"> Footer here </footer> </body>
The body uses d-flex flex-column min-vh-100 to create a vertical flex container with full viewport height. The main uses flex-grow-1 to fill available space, pushing the footer down.
Fill all three blanks to create a sticky footer layout with a flex column body, main content that grows, and footer pushed to bottom.
<body class="[1]"> <main class="[2]"> <div class="container"> <h3>Page Content</h3> <p>More text here.</p> </div> </main> <footer class="bg-primary text-white text-center [3] p-3"> Sticky footer </footer> </body>
The body uses d-flex flex-column min-vh-100 for vertical flex layout with full height. The main uses flex-grow-1 to fill space. The footer uses mt-auto to push itself to the bottom.
