How to create Bootstrap footer?
There is no built-in component for creating the fixed/sticky or simple footer like forms, buttons, tooltips, popovers etc. However, by using a few CSS styles/properties you may create fixed or static footer easily.
You may include other components in the footer with a few line of codes.
In this article, I am going to show you a few footer templates based on Bootstrap 4 framework that you may use in your Bootstrap projects.
You simply need to use the <footer> tag after all other content where you require to refer the .footer class shown below. It will create a sticky footer that remains fixed even vertical scroll bar appears. Have a look at the demo and code online:
See online demo and code
The style for the footer:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
<style> .footer { position: fixed; bottom: 0; width: 100%; height: 55px; background-color: #DFDFDF; } </style> The markup used for the footer: <footer class="footer"> <div class="container"> <p>© Company Name | Privacy Policy | Terms of Service</p> </div> </footer> |
In the CSS code, you can see the position is used as fixed. That makes the footer fixed as you scroll down the page.
Tweaking a little for centered text and linear background
This sticky footer is centered text and uses padding for lowering the text along with changing the background a bit. For that, a linear background is added along with other properties to stand out the fixed footer. Have a look:
See online demo and code
Only this style is changed then the above example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
<style> .footer { position: fixed; height: 55px; bottom: 0; color:#fff; padding-top:20px; width: 100%; background: #00003E; background: -webkit-linear-gradient(to right, #31BDE6, #00003E); background: linear-gradient(to right, #31BDE6, #00003E); text-align:center; } </style> |
You may use this large footer menu in Bootstrap if the footer is supposed to contain many links. For example, for services like hosting, an e-commerce store or any other website, the footer may require presenting a good number of link or information that goes across the site. Have a look at the demo and code of CSS and HTML:
See online demo and code
Note: The demo may look cluttered in the example page. However, if you just copy/paste the code in your own editor and run in your system, it should work fine – as shown in above graphics.
The Style for this footer:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 |
<style> .full { width: 100%; } .footer { height: auto; padding-bottom: 30px; position: relative; width: 100%; color:#fff; border-bottom: 1px solid #CCCCCC; border-top: 1px solid #DDDDDD; background: #00003E; background: -webkit-linear-gradient(to right, #31BDE6, #00003E); background: linear-gradient(to right, #31BDE6, #00003E); } .footer h3 { border-bottom: 1px solid #BAC1C8; color:#fff; font-size: 18px; font-weight: 600; line-height: 27px; padding: 40px 0 10px; text-transform: uppercase; } .footer ul { font-size: 13px; list-style-type: none; margin-left: 0; padding-left: 0; margin-top: 15px; color: #7F8C8D; } .footer ul li a { padding: 0 0 5px 0; display: block; } .footer a { color: #78828D; color:#fff; } .supportLi h4 { font-size: 20px; font-weight: lighter; line-height: normal; margin-bottom: 0 !important; padding-bottom: 0; } .subscribe-btn .btn { border: medium none; border-radius: 4px; display: inline-block; height: 40px; padding: 0; width: 100%; color: #fff; margin-top:10px; } .subscribe-btn { overflow: hidden; } .social li { border: 2px solid #B5B5B5; -webkit-border-radius: 50%; -moz-border-radius: 50%; -o-border-radius: 50%; -ms-border-radius: 50%; border-radius: 50%; float: left; height: 36px; line-height: 36px; margin: 0 8px 0 0; padding: 0; text-align: center; width: 36px; transition: all 0.5s ease 0s; -moz-transition: all 0.5s ease 0s; -webkit-transition: all 0.5s ease 0s; -ms-transition: all 0.5s ease 0s; -o-transition: all 0.5s ease 0s; } .social li a { color: #EDEFF1; } .social li:hover { border: 2px solid #2c3e50; background: #2c3e50; } .social li a i { font-size: 16px; margin: 0 0 0 5px; color: #EDEFF1 !important; } .footer-bottom { background: #40E0D0; background: -webkit-linear-gradient(to right, #FF0080, #FF8C00, #40E0D0); background: linear-gradient(to right, #FF0080, #FF8C00, #40E0D0); border-top: 1px solid #DDDDDD; padding-top: 20px; padding-bottom: 40px; color:#fff; } .footer-bottom p.pull-left { padding-top: 6px; } .payments { font-size: 1.5em; } </style> |
The markup of footer section only:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 |
<footer> <div class="footer" id="footer"> <div class="container"> <div class="row"> <div class="col-lg-2 col-md-2 col-sm-4 col-xs-6"> <h3> Specials</h3> <ul> <li> <a href="#"> Product 1</a> </li> <li> <a href="#"> Product 1 </a> </li> <li> <a href="#"> Product 3 </a> </li> <li> <a href="#"> Product 4 </a> </li> <li> <a href="#"> Product 5 </a> </li> </ul> </div> <div class="col-lg-2 col-md-2 col-sm-4 col-xs-6"> <h3> Services </h3> <ul> <li> <a href="#"> Services 1 </a> </li> <li> <a href="#"> Services 2 </a> </li> <li> <a href="#"> Services 3 </a> </li> <li> <a href="#"> Services 4 </a> </li> <li> <a href="#"> Services 5 </a> </li> </ul> </div> <div class="col-lg-2 col-md-2 col-sm-4 col-xs-6"> <h3> About </h3> <ul> <li> <a href="#"> Our Company </a> </li> <li> <a href="#"> About Us </a> </li> <li> <a href="#"> Terms of Services </a> </li> <li> <a href="#"> Our Team </a> </li> </ul> </div> <div class="col-lg-2 col-md-2 col-sm-4 col-xs-6"> <h3> Contact </h3> <ul> <li> <a href="#"> Contact Marketing </a> </li> <li> <a href="#"> Contact Sales </a> </li> <li> <a href="#"> Contact HR </a> </li> <li> <a href="#"> Contact Admin </a> </li> </ul> </div> <div class="col-lg-3 col-md-3 col-sm-6 col-xs-12 "> <h3> Subscribe Us </h3> <ul> <li> <div class="input-append subscribe-btn text-center"> <input type="text" class="full text-center" placeholder="Email "> <button class="btn btn-success" type="button"> Subscribe <i class="fa fa-save"> </i> </button> </div> </li> </ul> <ul class="social"> <li> <a href="#"> <i class=" fa fa-facebook"> </i> </a> </li> <li> <a href="#"> <i class="fa fa-twitter"> </i> </a> </li> <li> <a href="#"> <i class="fa fa-google-plus"> </i> </a> </li> <li> <a href="#"> <i class="fa fa-pinterest"> </i> </a> </li> <li> <a href="#"> <i class="fa fa-youtube"> </i> </a> </li> </ul> </div> </div> <!--/.row--> </div> <!--/.container--> </div> <!--/.footer--> <div class="footer-bottom"> <div class="container"> <p class="pull-left"> Copyright © 2004-2018. All rights reserved. </p> <div class="pull-right"> <ul class="nav nav-pills payments"> <li>We Accept: </li> <li><i class="fa fa-cc-paypal"></i></li> <li><i class="fa fa-cc-mastercard"></i></li> <li><i class="fa fa-cc-amex"></i></li> <li><i class="fa fa-cc-visa"></i></li> </ul> </div> </div> </div> <!--/.footer-bottom--> </footer> |
The upper markup is only for showing some content with the footer.
The markup and most of the CSS is same for this footer template as in above example. I just changed the linear background colors for both footer classes along with button style, payment option icons size etc. Have a look:
See online demo and code
The CSS:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
.footer { height: auto; padding-bottom: 30px; position: relative; width: 100%; color:#fff; border-bottom: 1px solid #CCCCCC; border-top: 1px solid #DDDDDD; background: #182765; background: -webkit-linear-gradient(to right, #FDBD37, #B92020, #182765); background: linear-gradient(to right, #FDBD37, #B92020, #182765); } And .footer-bottom { background: #d9a7c7; background: -webkit-linear-gradient(to right, #fffcdc, #d9a7c7); background: linear-gradient(to right, #fffcdc, #d9a7c7); border-top: 1px solid #DDDDDD; padding-top: 20px; padding-bottom: 40px; color:#000; } |
See the complete code on the demo page.