I want to keep my footer at the bottom no matter the height of the page. I have been able to do this until i added a linear gradient
for the background. I needed to add min-height:100%;
on the html div
to fill the whole page with the linear gradient background color
. However now my footer has some blank space below it and its not completely at the bottom.
the pages where my height is long enough to scroll to the bottom the footer works right..
the pages where the height is the whole page without scrolling the navbar seems to have space underneath it. and it looks like it's sticking below whatever div came before the footer.
html {
min-height: 100%;
}
body {
background: linear-gradient(45deg, rgb(51, 173, 255), rgb(128, 255, 212))no-repeat;
margin: 0;
height: 100%;
}
#wrap {
min-height: 100%;
}
#main {
overflow: auto;
padding-bottom: 200px;
}
/* must be same height as the footer */
#footer {
position: relative;
margin-top: -200px;
/* negative value of footer height */
height: 200px;
background-color: #484848;
opacity: 0.8;
width: 100%;
color: #fff;
clear: both;
}
application.html.erb
<html>
<body style="min-width:1100px;">
<div id="header" style="min-width:1120px;">
<% if content_for?(:navbar) %>
<%= yield(:navbar) %>
<% else %>
<%= render 'shared/navbar' %>
<% end %>
</div>
<div id="wrap">
<div id="main">
<%= render 'shared/message' %>
<%= yield %>
</div>
</div>
<div id="footer" style="min-width:1120px;">
<%= render 'shared/footer' %>
</div>
</body>
</html>