Reputation: 17
I'm having trouble trying to get my footer to actually stay at the bottom of the content. I tried the bootstrap sticky footer example, but it didn't work for me. Any help and code suggestions is appreciated.
Here's the CSS. And here's a live version to see what it's doing. https://jsfiddle.net/2f9zsu7d/2/
body {
background-color: #02060A;
}
#header {
width: 950px;
height: 200px;
}
.row.no-pad {
margin-right:0;
margin-left:0;
}
.row.no-pad > [class*='col-'] {
padding-right:0;
padding-left:0;
}
/*!
* Start Bootstrap - Simple Sidebar HTML Template (http://startbootstrap.com)
* Code licensed under the Apache License v2.0.
* For details, see http://www.apache.org/licenses/LICENSE-2.0.
*/
#wrapper {
min-height: 100%;
height: auto !important;
height: 100%;
width: 100%;
margin-bottom: -60px;
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
transition: all 0.5s ease;
}
#sidebar-wrapper {
position: absolute;
min-height: 100%;
width: 250px;
overflow-y: auto;
overflow-x: hidden;
background-color: #fff;
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
transition: all 0.5s ease;
}
#page-content-wrapper {
position: absolute;
width: calc(100% - 250px);
min-height: 100%;
padding: 15px;
left: 250px;
background-color: #fff;
border-left: 1px solid #080D11;
}
/* Sidebar Styles */
.sidebar-nav {
position: absolute;
top: 0;
width: 250px;
margin: 0;
padding: 0;
list-style: none;
color: #575959;
}
.sidebar-nav li {
text-indent: 20px;
line-height: 40px;
}
.sidebar-nav li i {
text-indent: 0px;
}
.sidebar-nav li a {
display: block;
text-decoration: none;
color: #575959;
-webkit-transition: all 0.5s;
-moz-transition: all 0.5s;
-o-transition: all 0.5s;
transition: all 0.5s;
}
.sidebar-nav li a:hover {
text-decoration: none;
color: #CF9139;
padding-left: 35px;
}
.sidebar-nav li a:active,
.sidebar-nav li a:focus {
text-decoration: none;
}
.sidebar-nav > .sidebar-brand {
background-color: #050A0E;
height: 50px;
font-size: 18px;
line-height: 50px;
color: #CF9139;
border-bottom: 1px solid #CF9139;
}
/*
*End of navigation
--------------------------------
*/
/*Content*/
.content-wrapper {
background-color: #02060A;
width: 100%;
min-height: 100px;
height: auto;
margin-bottom: 20px;
border: 1px solid #080D11;
}
.content-wrapper .title {
height: 50px;
line-height: 50px;
font-size: 18px;
text-indent: 25px;
background-color: #050A0E;
color: #CF9139;
border-bottom: 1px solid #CF9139;
}
.content-wrapper .title .avatar {
position: relative;
border: 1px solid #CF9139;
height: 60px;
width: 60px;
float: left;
background-color: #000;
top: -5px;
left: 15px;
}
.content-wrapper .message {
margin: 15px;
}
.content-wrapper .message p {
color: #575959;
}
.content-wrapper .message a {
text-decoration: underline;
color: #939595;
}
.content-wrapper .message .subTitle {
position: relative;
font-size: 14px;
line-height: 14px;
width: 100%;
border-top: 1px solid #575959;
bottom: 0;
padding-top: 5px;
color: #575959;
}
.content-wrapper .message .subTitle a {
text-decoration: underline;
color: #939595;
}
/*Footer*/
#push {
height: 60px;
}
#footer {
width: 100%;
height: 60px;
background-color: #02060A;
border-top: 1px solid #080D11;
}
#footer p {
color: #575959;
}
#footer .footer_wrapper {
height: auto;
margin: 15px;
}
#footer .footer_wrapper .aff {
float: right;
margin-left: 5px;
}
#footer .footer_wrapper .link {
float: right;
margin-left: 5px;
}
#footer .footer_wrapper .ipv6 {
float: right;
}
Upvotes: 0
Views: 55
Reputation: 430
I think this is what your trying to achieve? https://jsfiddle.net/2f9zsu7d/3/
If it is, you are absolutely positioning elements in the container before it. This means that container will not have a height associated with it, unless you specifically define a height on it. I think the method you might want to go with would be something similar to the following below.
*, *:before, *:after {
box-sizing: inherit;
margin: 0;
padding: 0;
}
.body {
background: #efeffe;
}
.header {
height: 100px;
background: #bbb;
}
.sidebar {
width: 250px;
float: left;
background: tomato;
height: 100px;
}
.content {
margin-left: 275px;
background: #efefef;
height: 100px;
}
.footer {
background: #ddd;
height: 25px;
}
<div class="body">
<div class="header">
<p>This is your header container</p>
</div>
<div class="contentWrapper">
<div class="sidebar">
<p>This sidebar is floated and has a hard width of 200px.</p>
</div>
<div class="content">
<p>This box is not floated, however is has a margin-left greater than the width of the sidebar.</p>
</div>
</div>
<div class="footer">
<p>This is your footer</p>
</div>
</div>
Upvotes: 1