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 trial
Reginald Beneke
Courses Plus Student 4,282 PointsFooter sticks to the bottom on some pages and floats in the middle of the other pages
I have a problem with my footer.
It sticks to the bottom on some pages and on others it floats in the middle of the page.
How can I fix this?
Here's all the code I have on the footer:
/******************************************FOOTER***************************************/
[id="block-websitefooter"] p:nth-child(1),
[id="block-websitefooter"] p:nth-child(2),
[id="block-websitefooter"] p:nth-child(3),
[id="block-websitefooter"] p:nth-child(4),
[id="block-websitefooter"] p:nth-child(5) {
display: inline-block;
color: white;
font-family: "G-Roboto-n5";
text-align: center;
}
[id="block-websitefooter"] {
background-color: $footer-darkgrey;
text-align: center;
}
[id="block-websitefooter"] .field__item {
height: 100px;
margin-bottom: -70px;
width: 1028px;
margin-right: -2px;
}
body > footer {
clear: both;
}
/*WEBSITE PROUDLY DESIGNED AND DEVELOPED BY*/
[id="block-websitefooter"] p:nth-child(1) {
font-family: "G-Roboto-n5";
color: $footer-text;
margin-right: 10px;
font-size: 16px;
margin-left: -736px;
margin-top: 42px;
}
/*LOGO*/
[id="block-websitefooter"] img {
margin-right: 10px;
margin-left: 201px;
}
[id="block-websitefooter"] .field__item {
margin-left: 226px;
}
/*FOOTER EMAIL ADDRESS*/
.region-footer .contextual p {
margin-top: -50px;
}
/*WORDS + LOGO*/
[id="block-websitefooterimage"] p {
margin-top: -61px;
margin-left: 616px;
font-family: "arial";
font-size: 18px;
color: white;
}
/*ADDRESS*/
[id="block-websitefooteraddress"] .field__item p {
margin-left: 1082px;
margin-top: -2px;
font-family: "Arial";
font-size: 12px;
color: $footer-text;
}
/*EMAIL*/
[id="block-websitefooteremail"] .field__item p {
margin-left: 1082px;
font-family: "Arial";
font-size: 12px;
color: $footer-text;
margin-top: 1px;
}
1 Answer
Iain Simmons
Treehouse Moderator 32,305 PointsI can't see anything that would make your footer 'stick' anywhere. Rather, it presumably just comes after the other content, so its position on the page is dependent on the content above it.
Do you have all of your code (HTML, CSS, etc) in a Workspace? If so, can you please share a snapshot?