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
Luis Moreno Pernil
3,275 Pointsmargin problems
i´ve done the "how to make a website" course and i started to code my own website , but i had some issues . I set the margin to 0 and there is a white space between the toolbar of the browers and the nav , can anyone solve it .
this is the code i ´ve used :
.heading {
width: 100%; margin: 0 0; float: none; background-color: #34495E; color: #F9BF3B; height: 335px; text-align: center;
}
6 Answers
highlandcow
7,352 PointsRemove the margins from the body
body {
margin: 0;
}
Rafael Peralta Jr
21,879 PointsI would suggest using the Inspector Tool on your browser to determine what is causing the problem. There might be some default padding or margin issue somewhere.
Andreas Anastasiades
2,916 PointsYour margin is set to the .heading div Possibly there's still some margin or padding left on the header itself?
Also, a lot of your images their alt tags have an error, you used a whitespace in stead of the = sign
Luis Moreno Pernil
3,275 Pointshi , guys . i set the top margin to -21px and it dispeared , thanks (everyone)
Luis Moreno Pernil
3,275 Pointshi , guys . i set the top margin to -21px and it dispeared , thanks (everyone)
Nick Pettit
Treehouse TeacherThere's a few problems with the markup you posted. For example, the title tag is not closed properly.
<title> Luis Moreno </title
In addition, your alt attributes on images don't have an equal sign between the alt keyword and the double quotes. This is not valid markup:
<img src="code.png" alt "code icon">
Instead, you need to change all instances of these and add an equals sign, like this:
<img src="code.png" alt="code icon">
You also have an inline element that's not properly closed:
<h1> Luis Moreno </h1>
<span>
That span element that's not closed could be causing the entire page to be rendered as an inline element, instead of a block level element, so styling might not be applied correctly.
Once you've fixed all these problems, try running your code through the W3C's markup validation service to check for additional errors. If the problem still isn't fixed and you're still seeing the extra page margin, post your code here again as a new answer.
highlandcow
7,352 Pointshighlandcow
7,352 PointsFYI - This code was included in the normalize stylesheet in the course. http://nicolasgallagher.com/about-normalize-css/
Luis Moreno Pernil
3,275 PointsLuis Moreno Pernil
3,275 Pointsit doesn´t work , any suggest ,
highlandcow
7,352 Pointshighlandcow
7,352 PointsCould you post all of your HTML and CSS?
Luis Moreno Pernil
3,275 PointsLuis Moreno Pernil
3,275 Pointshow can i post it , i´m new on this platform
Luis Moreno Pernil
3,275 PointsLuis Moreno Pernil
3,275 Points