How to create footer to stay at the bottom of a Web page?
To create a footer to stay at the bottom of a web page We can fix the position of it at the bottom of the webpage so that, if you scroll down that webpage you can still view the footer from any position at the page.
To make a footer fixed at the bottom of the webpage, you could use position: fixed.
Syntax:
#footer {
position:absolute;
bottom:0;
width:100%;
height:60px; /* Height of the footer */
background:#6cf;
}
Example:
<html> <head> <style> #footer { position: fixed; padding: 10px 10px 0px 10px; bottom: 0; width: 100%; /* Height of the footer*/ height: 40px; background: grey; } </style> <head> <body> <center> <div id="container"> <h1>GeeksforGeeks</h1> <h1>GeeksforGeeks</h1> <h1>GeeksforGeeks</h1> <h1>GeeksforGeeks</h1> <h1>GeeksforGeeks</h1> <h1>GeeksforGeeks</h1> <h1>GeeksforGeeks</h1> <h1>GeeksforGeeks</h1> <h1>GeeksforGeeks</h1> <h1>GeeksforGeeks</h1> <h1>GeeksforGeeks</h1> <h1>GeeksforGeeks</h1> <div id="footer">This is a footer. This stays at the bottom of the page. </div> </div> </center> </body> <html> |
chevron_right
filter_none
Output:

Recommended Posts:
- How to scroll automatically to the Bottom of the Page using jQuery?
- How to create Responsive Bottom Navigation Bar using Bootstrap ?
- How to create fade-in effect on page load using CSS ?
- Service Worker | How to create custom offline page ?
- How to display search result of another page on same page using ajax in JSP?
- How to redirect a page to another page in HTML ?
- HTML5 | <footer> Tag
- HTML | DOM Footer Object
- HTML Course | Building Footer
- How to align buttons in Card footer in Bootstrap ?
- How to show Page Loading div until the page has finished loading?
- CSS | bottom Property
- Web API | DOMRect bottom property
- How to align content of a div to the bottom using CSS ?
- PHP | SplDoublyLinkedList bottom() Function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



