"Footer"
Bootstrap 3.2.0 Snippet by kdawgwilk

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<link href="//netdna.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//netdna.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<!------ Include the above in your HEAD tag ---------->
<body>
<div class="wrapper">
<div class="container">
<p>Main content</p>
<p>Main content</p>
<p>Main content</p>
<p>Main content</p>
<p>Main content</p>
<p>Main content</p>
<p>Main content</p>
<p>Main content</p>
<p>Main content</p>
<p>Main content</p>
<p>Main content</p>
<p>Main content</p>
<p>Main content</p>
<p>Main content</p>
<p>Main content</p>
<p>Main content</p>
<p>Main content</p>
<p>Main content</p>
<p>Main content</p>
<p>Main content</p>
</div>
</div>
<footer>
<p>Centred footer content</p>
</footer>
</body>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
2
3
4
5
6
7
8
9
10
11
12
13
.wrapper {
min-height: 100%;
}
.container {
overflow: auto;
padding-bottom: 100px
}
footer {
position: relative;
clear: both;
height: 100
margin-top: -100px
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
(function () {
$(document).ready(function() {
setFooterHeight();
});
$(window).resize(function() {
setFooterHeight();
});
function setFooterHeight() {
var container = $(".container"),
footer = $("footer"),
overlap = 25,
footerHeight = $(window).height() - container.height(),
totalHeight = footerHeight + overlap;
if ( footerHeight < 0 ) {
footer.css({
"margin-top" : -overlap
});
} else {
container.css({
"padding-bottom" : footerHeight
});
footer.css({
"margin-top" : -totalHeight,
"height" : totalHeight
});
}
}
})();
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Related: See More


Questions / Comments: