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
Luca Sorgiacomo
8,989 PointsCan't get div to span full width
Hi all,
here's the very simple code I'm working on but this will still result in the .container div leaving a white line on the left and top…if I use static or relative positioning the white line is on the right too, as if there was padding on the body element – and that's that's why I put padding:0; on both html and body…but still nothing.
What am I doing wrong?
4 Answers
Matt Campbell
9,767 PointsYou need to put 0 margin on the body.
Even better would be to use normalize.css. It's essential for cross browser compatibility.
James Barnett
39,199 PointsYou removed padding from the body but you forgot about margin.
Luca Sorgiacomo
8,989 PointsRight! Thought that it was default...Thanks so much!
James Barnett
39,199 PointsLuca Sorgiacomo - You thought what was the default? normalize.css? margin: 0 on body?
Luca Sorgiacomo
8,989 PointsI meant the margin: 0 on body
Peter Hatzer
20,837 PointsSet the body margin to 0px
An other good idea is set all the elements to 0px.
example:
- { padding: 0px; margin: 0px; }
James Barnett
39,199 PointsPeter Hatzer - A much better choice is to use normalize.css. Here's a great article about the downsides of using a universal selector for a reset.