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

CSS CSS Foundations Selectors Class and ID Selectors

How do I remove spaces between header,body,footer when i wrap all these in div and set it to wdth:740px; margin:auto?

in this video gil uses different colors for footer ,header and footer and there is no spaces between then.when i create on my own i can see spaces between then.So ,how do i avoid it?

3 Answers

Hey, can you paste your code please?

<html> <head>

<style>

.container{

width:800px; margin:auto;

}

.main-header{

height:100px; color:white; background-color:black;

} .main-content{ padding:30px; background-color:green;

}

</style>

</head>

<body> <div class="container"> <header class="main-header">myhead</header>

<!-- <div class="main-content">--> <p class="main-content">

  The Indian cricket team won the 2011 Cricket World Cup under his captainship. His Test cricket and One Day International records are the best among all Indian captains to date. He took over the ODI captaincy from Rahul Dravid in 2007 and led the team to its first ever inter-country ODI series wins in Sri Lanka and New Zealand. Dhoni also holds the post of Vice-President of India Cements Ltd. after resigning from Air India. India Cements is the owner of the Indian Premier League team Chennai Super Kings, and Dhoni has been its captain since the first edition of IPL.[5][6]

</p>

</div>
</div>
</body>

</htm> l

<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, inital-scale=1">
<title>Test</title>
<style>
.container{
margin:auto;
width:800px; 
}
.main-header{
height:100px; 
color:white; 
background-color:black;

}
 .main-content{ 
padding:30px; 
background-color:green;

}
</style>
</head>
<body>
<div class="container">
<p class="main-content">

  The Indian cricket team won the 2011 Cricket World Cup under his captainship. His Test cricket and One Day International records are the best among all Indian captains to date. He took over the ODI captaincy from Rahul Dravid in 2007 and led the team to its first ever inter-country ODI series wins in Sri Lanka and New Zealand. Dhoni also holds the post of Vice-President of India Cements Ltd. after resigning from Air India. India Cements is the owner of the Indian Premier League team Chennai Super Kings, and Dhoni has been its captain since the first edition of IPL.[5][6]

</p>

</div>
</div>
</body>
</html>

Is this the code you want? I can't see that you have added a footer element or a footer class so that is why the footer is not displaying.

Hey,

This is what I get.

http://imgur.com/1iDaerK .