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

Coby Dennison
PLUS
Coby Dennison
Courses Plus Student 1,496 Points

Main header and margin

I have been trying to practice html/css together. With what I have so far it is alright besides how there is space on the outside of my main header. What do I need to add so that there is no white space and the header takes up all of the space? Thank you. (my coding is below)

<!DOCTYPE html> <html> <head> <title>Name of Company</title> <link rel="stylesheet" type ="text/css" href="../css/style.less"> </head> <body> <header class="main-header"> <h1>Title</h1> </header> </body> </html>

(and then css)

.main-header { background-image: linear-gradient(firebrick, orange); padding-top: 170px; height: 850px; box-sizing: border-box; margin: auto;

}

h1 { font-family: sans-serif; font-size: 75px;

}

2 Answers

Christopher De Lette
PLUS
Christopher De Lette
Courses Plus Student 7,139 Points

Hi Coby,

Create a body rule in your css and set to margin:0 as well as padding:0.

body {
  margin:0;
  padding: 0;
}

Hope this helps and happy coding!

Coby Dennison
Coby Dennison
Courses Plus Student 1,496 Points

First off, thank you Chris! And it did fix the left side and some of the right, but there is still space on top? Again, thank you.

Tianni Myers
Tianni Myers
10,453 Points

Inspect the element and try to figure it out lol Or try the normalize.css file for your project.