Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to keep footer at bottom of screen [duplicate]

Tags:

html

css

What is best practice for setting up a web page so that if there is very little content/text to be displayed on that web page the footer is displayed at the bottom of the browser window and not half way up the web page?

like image 770
grabury Avatar asked Sep 11 '13 11:09

grabury


People also ask

Why won't my footer stay at the bottom html?

The reason you can't have a normal footer on your page is because you have used absolute positioning for your content and columns. Absolute elements are removed from the flow and you can't place a footer under absolute columns.

How do you keep an element at the bottom of the screen?

Set the position of div at the bottom of its container can be done using bottom, and position property. Set position value to absolute and bottom value to zero to placed a div at the bottom of container.

How do I keep the footer at the bottom of the page in Wordpress?

Use the WPFront Notification Bar Plugin To enable the floating footer bar, select the option to fix the bar at the bottom position. What is this? Change the position from “top” to “bottom”. Check the box to enable “fixed at position” which is what fixes it to the bottom of the screen.


1 Answers

What you’re looking for is the CSS Sticky Footer.

* {    margin: 0;    padding: 0;  }    html,  body {    height: 100%;  }    #wrap {    min-height: 100%;  }    #main {    overflow: auto;    padding-bottom: 180px;    /* must be same height as the footer */  }    #footer {    position: relative;    margin-top: -180px;    /* negative value of footer height */    height: 180px;    clear: both;    background-color: red;  }      /* Opera Fix thanks to Maleika (Kohoutec) */    body:before {    content: "";    height: 100%;    float: left;    width: 0;    margin-top: -32767px;    /* thank you Erik J - negate effect of float*/  }
<div id="wrap">    <div id="main"></div>  </div>    <div id="footer"></div>
like image 183
Jezen Thomas Avatar answered Oct 05 '22 22:10

Jezen Thomas