Skip to content
Related Articles

Related Articles

How to create footer to stay at the bottom of a Web page?
  • Last Updated : 23 May, 2019

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>

Output:

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.




My Personal Notes arrow_drop_up
Recommended Articles
Page :