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 trialJoshua Comrie
3,861 PointsWhy is my footer going to the top?
Hi guys. Being doing HTML & CSS for a few months now and have a problem. I just started college and need to build a web page as one of my assignments. Anyway, I am trying to get my footer to go where it should be, at the bottom. For some reason it's going towards the top of the page. If anyone can help me, it would be great. Thanks!
<!DOCTYPE html>
<html>
<head>
<link href="https://fonts.googleapis.com/css?family=Roboto+Condensed" rel="stylesheet">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="contact.css">
<title>Contact Us</title>
</head>
<body>
<div class="block">
<div id="nav">
<ul>
<li><a href="home.html">Home</a></li>
<li><a href="">Design</a></li>
<li><a href="">Create</a></li>
<li><a href="">Legal</a></li>
<li><a href="">Publishing</a></li>
<li><a href="contact.html">Contact</a></li>
</ul>
</div>
<div class="wrapper">
<section id="boxes">
<div class="container">
<div class="box">
<h1>Contact Us</h1>
<div class="phone">
<img src="phone.jpg" height="175px width="150px">
</div>
<h3>Phone +447837574081</h3>
<h4>Opening Hours: Mon - Friday 9:00 - 17:00</h4>
<p>Address: 123 High Street<br></p>
<p>Rotherham</p>
<p>South Yorkshire</p>
<p>S60 4DH</p>
</div>
</section>
</div>
</section>
</div>
</wrapper>
<div class="wrapper2">
</section id="Question">
<div class="box2">
<h3>Have A Question?</h3>
<img src="mail.png" height="175px" width="175px">
<form><br>
First Name: <input type="text" name="" placeholder="First Name...">
</form></div><br>
<form>
Last Name: <input type="text" name="" " placeholder="Last Name...">
</form><br>
<form>
Email Address: <input type="text" name=""" placeholder="Email Address...">
</form><br>
Question: <br><textarea>
</textarea rows="4" cols="50">
<form><br>
<button>Submit</button>
</div>
</form>
</div>
</section>
</div>
</wrapper>
<div class="footer">
<p>How To Create A Web Page, Copyright © 2018</p>
</</div>
</body>
</html>
body{
background-color: #cce6ff;
font-family: 'Roboto Condensed', sans-serif;
margin: 0;
padding: 0;
}
h1{
text-align: center;
}
p{
font-size: 20px;
text-align: center;
}
/* Nav Bar */
#nav {
font-size: 25px;
background-color: #0077b3;
height: 35px;
padding: 20px;
color: white;
border-bottom: white 2px solid;
}
#nav ul {
text-align: center;
list-style-type: none;
padding: 0;
margin: 0;
}
#nav li {
display: inline;
padding: 20px;
vertical-align: middle;
}
#nav a {
color: white;
padding: 10px 10px 10px 10px;
text-decoration: none;
vertical-align: middle;
}
#nav a:hover{
color: black;
text-decoration: bold;
background-color: #80d4ff;
border-radius: 10px;
}
.list2{
text-align: center;
list-style-type: none;
font-size: 25px;
margin: 0;
padding: 0;
}
.footer{
font-size: 25px;
background-color: #0077b3;
height: 105px;
color: white;
text-align: center;
padding: 0;
margin:0;
border-top: 3px solid white;
}
#copyright{
margin-top: 50px;
}
1 Answer
Stian Helgerud
7,828 PointsIn the css file, change the footer from " margin:0; " to " margin-top: 100%; "
Joshua Comrie
3,861 PointsHi Stian, thanks for the reply. Unfortunately that didn't work for me :(
Joshua Comrie
3,861 PointsMy bad i was putting px instead of %. Thank you :)
Rich Donnellan
Treehouse Moderator 27,696 PointsRich Donnellan
Treehouse Moderator 27,696 PointsQuestion updated with code formatting. Check out the Markdown Cheatsheet link below the "Add an Answer" for syntax examples.