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
Alexandru Georgian Chiurtu
7,008 PointsProblem
Hi i have a problem with my project.I can't remove the white space between header and wrapper.Here are some screenshots of the problem and the code: http://www.picoolio.net/image/Yen http://www.picoolio.net/image/Ye9 http://www.picoolio.net/image/Yep http://www.picoolio.net/image/Ye6 http://www.picoolio.net/image/YeL
Thank you for help
Alexandru Georgian Chiurtu
7,008 Points<!DOCTYPE html>
<html>
<head>
<title>Yosemite National Park</title>
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/main.css">
</head>
<body>
<header>
<h1>Yosemite</h1>
<h2>National Park</h2>
<a href="#"><img src="img/arrow.svg" class="arrow"></a>
</header>
<div id="wrapper">
<section id="first">
<h2>Informations</h2>
<p>Yosemite National Park is a United States National Park spanning eastern portions of Tuolumne, Mariposa and Madera counties in the central eastern portion of the U.S. state of California, commonly referred to as Northern California.</p>
<ul class="gallery">
<li><img src="img/sunset.jpg"></li>
<li><img src="img/forest.jpg"></li>
</ul>
</section>
</div>
</body>
</html>
body {
margin: 0;
}
* {
box-sizing: border-box;
}
img {
max-width: 100%;
}
#wrapper {
margin: 0 auto;
width: 960px;
}
.gallery {
margin: 0;
padding: 0;
list-style: none;
overflow: auto;
}
.gallery li {
float: left;
width: 45%;
margin: 2.5%;
}
/********** Header ***********/
header {
height: 750px;
background: url('../img/mountain2.jpg') no-repeat center center;
padding: 250px 0;
max-width: 100%;
text-align: center;
}
header h1,
header h2 {
margin: 0;
/*color: #7fcc7f;*/
color: white;
}
h1 {
font-size: 5em;
}
h2 {
font-size: 2em;
}
.arrow {
width: 60px;
height: 60px;
margin-top: 175px;
padding: 5px 2px 2px;
border: 1px solid white;
border-radius: 100%;
}
.arrow:hover {
background-color: #7fcc7f;
}
/********** first-section ***********/
#first {
text-align: center;
border-bottom: 1px solid black;
padding: 75px 0 75px;
}
1 Answer
Ted Sumner
Courses Plus Student 17,967 PointsI think what you have going on is a margin collapse. There is one easy way to find out. You have a bunch of 0 margins. Take them all out. The one margin that is real is the
#wrapper {
margin: 0 auto;
}
Try changing that to:
#wrapper {
margin-right: auto;
}
If that fixes it, then it is a margin collapse issue. The code for the clearfix is:
header:after {
content:"";
display:table;
clear:both;
}
Replace "header" with the parent element. The problem is discussed in detail here.
Alexandru Georgian Chiurtu
7,008 PointsThank you for help.
Ted Sumner
Courses Plus Student 17,967 PointsAny time.
Ted Sumner
Courses Plus Student 17,967 PointsTed Sumner
Courses Plus Student 17,967 PointsI cannot see the code. Will you please copy and paste both the HTML and CSS here. Follow the Markdown Cheatsheet to format the code properly.
My guess is that you have a margin collapse that can be fixed with clearfix.