8
I need to pin the tag footer at the end of the html page, but when the content exceeds the page by tag footer should follow the content and not be fixed.
See the CSS code is the HTML code I’m using for this.
header {
min-height: 55px; /* original era 255px mudei para caber no snippet */
background-color: blue;
}
article {
padding-bottom: 60px;
width: 900px;
margin: 0 auto;
}
footer {
position: absolute;
bottom: 0px;
width: 100%;
height: 60px;
background-color: green;
}
<header></header>
<article>
<p>Conteúdo</p><p>Conteúdo</p><p>Conteúdo</p><p>Conteúdo</p>
<p>Conteúdo</p><p>Conteúdo</p><p>Conteúdo</p><p>Conteúdo</p>
<p>Conteúdo</p><p>Conteúdo</p><p>Conteúdo</p><p>Conteúdo</p>
<p>Conteúdo</p><p>Conteúdo</p><p>Conteúdo</p><p>Conteúdo</p>
<p>Conteúdo</p><p>Conteúdo</p><p>Conteúdo</p><p>Conteúdo</p>
<p>Conteúdo</p><p>Conteúdo</p><p>Conteúdo</p><p>Conteúdo</p>
<p>Conteúdo</p><p>Conteúdo</p><p>Conteúdo</p><p>Conteúdo</p>
<p>Conteúdo</p><p>Conteúdo</p><p>Conteúdo</p><p>Conteúdo</p>
<p>Conteúdo</p><p>Conteúdo</p><p>Conteúdo</p><p>Conteúdo</p>
<p>Conteúdo</p><p>Conteúdo</p><p>Conteúdo</p><p>Conteúdo</p>
<p>Conteúdo</p><p>Conteúdo</p><p>Conteúdo</p><p>Conteúdo</p>
<p>Conteúdo</p><p>Conteúdo</p><p>Conteúdo</p><p>Conteúdo</p>
<p>Conteúdo</p><p>Conteúdo</p><p>Conteúdo</p><p>Conteúdo</p>
<p>Conteúdo</p><p>Conteúdo</p><p>Conteúdo</p><p>Conteúdo</p>
</article>
<footer></footer>
</body>
</html>
The problem is that the tag footer with the property position with the value fixed leaves the footer fixed.
When I change the property position for absolute the tag footer is floating and does not follow the content.

If there is little content on the page, the footer will not be fixed at the bottom: https://jsfiddle.net/b8gze2ta/
– Woss
Add to css left: 0; bottom: 0; Like this:
footer{
position: absolute;
background-color: red;
width:100%;
height:48px;
left: 0;
bottom: 0;
}– Wemerson Nino