Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialPhil White
Courses Plus Student 9,519 PointsFooter wont stick to the bottom of the page...
Hi,
I'm just making a basic site and the footer wont stick to the bottom of the page, it rides up and sits under the third column. My html and CSS is below.
How do i fix?
Phil White
Courses Plus Student 9,519 Pointsheader {
width: 1115px;
height: 100px;
background: -webkit-radial-gradient(#9a9a9a, #686868);
box-shadow: 0 2px 7px #04b0f7;
}
#main-header h1 {
clear: both;
margin-left: 400px;
padding-top: 75px;
padding-bottom: 100px;
color: #414141;
}
h1 {
margin-bottom: 0;
margin-left: 10px;
float: left;
}
h1 {
color: #04b0f7;
}
nav {
text-align: center;
padding: 10px 0;
margin: 20px 0 0;
float: right;
}
nav ul {
list-style: none;
margin: 0 10px;
padding: 0;
}
nav li {
display: inline-block;
}
nav a {
font-size: 16px;
padding: 15px 10px;
text-align: center;
color: white;
text-decoration: none;
transition-property: color;
transition-duration: 2s;
padding-left: 20px;
padding-right: 20px;
}
nav a:hover {
color: #05b3fb;
}
.portfolio {
background-image: url('../img/nav-icon-blue1.png');
background-repeat: no-repeat;
background-size: 19px;
}
li.portfolio {
padding-left:10px;
}
.about {
background-image: url('../img/nav-icon-blue2.png');
background-repeat: no-repeat;
background-size: 19px;
}
li.about {
padding-left:10px;
}
.contact {
background-image: url('../img/nav-icon-blue3.png');
background-repeat: no-repeat;
background-size: 19px;
padding-right: 0px;
}
li.contact {
padding-left: 5px;
}
li {
clear: both;
}
.contact{
clear: both;
}
body {
background-color: white;
}
h2 {
clear: both;
}
p {
clear: both;
}
/** Columns **/
.container {
clear: both;
-webkit-column-count: 3;
-webkit-column-gap: 75px;
}
.container .even-height {
float: left;
}
#column-1{
margin-left: 50px;
}
#column-2{
margin-right: 50px;
}
#column-3 {
margin-right: 50px;
}
#column-1 p {
color: #05b3fb;
}
#column-2 p {
color: #05b3fb;
}
#column-1 h2 {
text-align: center;
color: #414141;
}
#column-2 h2 {
text-align: center;
color: #414141;
}
.eifel {
border-radius: 100%;
margin-left: 30px;
width: 250px;
height: 250px;
}
.maldives {
border-radius: 100%;
margin-left: 30px;
width: 250px;
height: 250px;
}
footer {
height: 100px;
text-align: center;
background-color: #777777;
color: #05b3fb;
box-shadow: 0 -2px 7px #04b0f7;
}
footer p {
font-size: 20px;
padding-top: 40px;
padding-bottom: 40px;
}
3 Answers
Jason Anello
Courses Plus Student 94,610 PointsHi Phil,
You're using multi-column layout here and since your footer is inside the .container div it becomes part of the multi-column layout.
So one solution would be to move your footer after that div.
However, I would recommend against using multi-column layout. Support isn't high enough yet in my opinion. http://caniuse.com/multicolumn
Looking at that link you can see that you need to use both the -moz and -webkit prefixes as well as the unprefixed version to even get the 86% support and most of that is only partial support. You won't be able to control where the columns break.
I don't think that this was the intended use for this feature. It's more appropriate for newspaper or magazine style layout or maybe if you had a really long ordered list and wanted to flow it into multiple columns.
I would look for another way to layout your 3 columns. You could give them all a width and float them for example.
Phil White
Courses Plus Student 9,519 PointsHi Jason,
Thank you for your help! i did as you said and its working perfectly now.
Philip Cox
14,818 PointsHi Phil Here is a good article by Chris Coyer from CSS Tricks. This should help you. The only issue with sticky footers, is they require you to set the height of the page. Using % get around this, as Chris does. You could always have the footer use up the remainder of the page. This looks nice if you have a full width sections on your page with nice colour contrasts. Like the way Nick does it in the first 'how to make a website' course. Hope this helps :)
Phil White
Courses Plus Student 9,519 PointsThanks Philip, i think you forgot to put the link in the comment?
Philip Cox
14,818 PointsLOL! So I did. http://css-tricks.com/snippets/css/sticky-footer/ Sorry.
Phil White
Courses Plus Student 9,519 Pointslol no worries, thanks for your help!
Phil White
Courses Plus Student 9,519 PointsThis didn't really help. is there any other fixes?
Philip Cox
14,818 PointsSorry about that. I don't normally stick my footer, so not to sure. Maybe try creating a new project file and getting Chris;s example to work. Then implement your html into it?
Phil White
Courses Plus Student 9,519 PointsI don't think i'm necessarily trying to make a sticky footer but just want the footer to stay on the very bottom of the page like any basic site. and yeah ill try that
Philip Cox
14,818 PointsThis may be rather opinionated but, blocky layouts with lots of rectangles are not as common or popular as they once were. I try to think of my content as sections of content spanning the entire width of the page with a maximum width. If you have enough content to fill a single view in height, great, your footer is down at the bottom below your content. If you only have enough content so far to fill a 1/3 of your height, and your trying to force a footer to the bottom ( you can do this with a negative margin-top ) Then you will have lots of space in-between. And, when you add more content that space remains the same. Not setting a height allows your page to grow as you add content. So place your footer below your content with some once padding and margin, and fill the below space t match the same colour, this way it looks like one large footer. This of course is one way, and it's down to personal preference and design. :)
Phil White
Courses Plus Student 9,519 PointsPhil White
Courses Plus Student 9,519 Points