One of the main reasons I don’t like using this technique is because it involves the position: absolute
, which does not work in the case of a dynamic (responsive) website as it depends on the definition of the padding-bottom
. What I have used is the use of display:flex in body
. Something like that:
html {
height: 100%;
min-height: 100%;
}
body {
display: flex;
flex-direction: column;
min-height: 100%;
}
footer {
margin-top: auto;
}
In this way, you declare that the body
must be at least 100% high and the footer shall be fixed at the bottom of the page.
However, your current code is not working because the element .wrapper
also owns the property position
defined as absolute
, which will ignore its placement on the page. Simply remove this property and your code will work.
Possible duplicate of Footer at the end of the document
– leofontes
Thanks for the @leofonts reference, but it wasn’t exactly what I was looking for this link you passed on. I was also having footer problem going up together when the viewport was decreased. But with the help of Celsomtrindade I was able to solve.
– Mauricio Santos