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

HTML

Issues with container divs and margins

After applying container divs to my code my margins still haven't changed. Checked and rechecked the code, not sure what the problem is.

4 Answers

Thanks! I finally got it to work. I think it was because I put my index.html file together with the grid.css and normalize.css files (in a css folder). Somehow this was messing with the code in the html file, so I put it on my desktop and the margins came back.

When telling the browser where a file is going to be using the <link> tag ensure it knows what folder to look in like

<link src="css/grid.css">

Also if ou choose a best answer so people can see this is solved

What do you mean the margin's have not changed. I assume your container class looks something like this

.container {
    width: 60em;
    margin: 0 auto;
}

This should have an even margin either side.

I'm using

.container{
    width: 1000px; 
    margin: auto;

which is from the grid.css file that was given in the "Working with Grids" portion of web design, and I applied

<div class="container>....</div> 

within the body. But my margins won't appear. My page is still leaning to the far left.

oh, sorry my container div code is

<div class="container">....</div>

Have you also included th link to the grid.css file correctly?