Created
May 16, 2019 10:34
-
-
Save sarvar/be50324de9e06eb4e36887167a161eba to your computer and use it in GitHub Desktop.
Flexbox Sticky Footer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <body class="d-flex flex-column"> | |
| <div id="page-content"> | |
| <div class="container text-center"> | |
| <div class="row justify-content-center"> | |
| <div class="col-md-7"> | |
| <h1 class="font-weight-light mt-4 text-white">Sticky Footer using Flexbox</h1> | |
| <p class="lead text-white-50">Use just two Bootstrap 4 utility classes and three custom CSS rules and you will have a flexbox enabled sticky footer for your website!</p> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <footer id="sticky-footer" class="py-4 bg-dark text-white-50"> | |
| <div class="container text-center"> | |
| <small>Copyright © Your Website</small> | |
| </div> | |
| </footer> | |
| </body> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* Sticky Footer Classes */ | |
| html, | |
| body { | |
| height: 100%; | |
| } | |
| #page-content { | |
| flex: 1 0 auto; | |
| } | |
| #sticky-footer { | |
| flex-shrink: none; | |
| } | |
| /* Other Classes for Page Styling */ | |
| body { | |
| background: #007bff; | |
| background: linear-gradient(to right, #0062E6, #33AEFF); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment