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

"Working With Grids" Lesson: Margin Problem

I have contained the main contents of the simple website into the div with a container class. The container margin code came up on grid.css, but when I go to refresh the website page, nothing changes. Does anybody know what I am doing wrong? Please Help

Thank you in advance.

Wayne Priestley
Wayne Priestley
19,579 Points

Hi Eddie,

Can you paste the question and the code here, it will make it easier to help you, even a link to the challenge would do.

http://codepen.io/anon/pen/Ajzxh

Go to this link, it shows my code that is inside of the container class div.

4 Answers

http://codepen.io/anon/pen/Ajzxh

Go to this link, it shows my code that is inside of the container class div.

Wayne Priestley
Wayne Priestley
19,579 Points

Hi Eddie,

I understand the html, but what is the grid or margin question?

is it asking you to make the .container 100% in the css or asking you to add a margin to the .container?

or change the grid to % from px?

sorry I'm not getting what you mean.

Well, it wants you to add the margin to the .container, but because of grid.css, it has already done that for us. So when I contain the code, the .container shows up in the grid.css, but I go to refresh the website page, and it does not change anything.

Wayne Priestley
Wayne Priestley
19,579 Points

as long as you add the

.container {
margin: 5%;
}

after any other reference to another margin, the .container should over ride the others as css always defers to the element lowest down your page.

Sorry I am being so unclear about this whole process, I am new to this. On the .css file, it already gives you the margin. But for some reason, after my coding, the margin for the contained code does not activate. And it is not about a challenge, the instructor explains this in one of his videos

Wayne Priestley
Wayne Priestley
19,579 Points

Eddie,

Really no need to say sorry, we've all been there, i watched the html & css tutorials 3 times before i was comftable with them.

its like trying to talk in a new language before you've learned it :)

my best advice is to change things 1 thing at a time then look to see how it changes your site, learn by doing.

Put big margins in the grid.css file and see how things change.

check to see if the file is linked properly to your html page.

copy the grid.css from its page and paste it into your style.css page (at the top) and see if anything changes.

good luck Eddie.

Hey Eddie,

When I checked out your Codepen code, there doesn't seem to be any CSS, only the HTML. Also, in the HTML, you are missing the head element in which to put a link to the grid.css, once you get that up and running together with your HTML.

My suggestion is to go back and watch the same videos again and also to take full advantage of and study the Codepen codes provided. That's how I've been able to more fully understand the material myself.

I agree with Wayne about learning and understanding new things taking more time than we might like them to, but just keep trying until you get it right. When you do eventually get it, you won't soon forget it :)

Hey Frank,

Thanks for the help, but now I am having some extra problems. I tried to figure out what was wrong with the html code, and because of this, I cannot reset CSS, which is important in the video.

Hey Frank,

Thanks for the help, but I am having a little bit of trouble understanding what you mean. I have been watching the videos, and cant spot a difference. Could you please specify where my HTML went wrong, because I cannot find it.

Hey Frank,

Thanks for the help, but I am having a little bit of trouble understanding what you mean. I have been watching the videos, and cant spot a difference. Could you please specify where my HTML went wrong, because I cannot find it.