Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

HTML

having a problem with 'working with grids' container div tag Smells Like Bakin

I have put my container div tags inside the body tags, which is supposed to constrain my webpage to 1000px and center everything, but when I refresh and check it, it's all centered until I get down to "fresh out the oven" from there the rest of the page is still on the left side.

Now I don't really know if its supposed to be like this because the teacher doesn't scroll down on his website to show us - but I'm pretty sure those div tags should contain the whole body and center everything.

I have checked and rechecked my code and just can't see where I've gone wrong, it's probably something really simple but I just can't see it. Please have a look at my code below.

Many thanks in advance!

4 Answers

sigh...how do I paste my html code here? whenever I paste it it messes up/misses out most of the top half, is it because im using notepad++ and not sublime or something?

James Barnett
James Barnett
39,199 Points

Lisa - You need to use markdown's code blocks.

```html
[code goes here]
```

Here's an example of some code rendered with syntax-highlighting:

<p>I'm code with syntax highlighting</p>

You can read more about creating code blocks in markdown in this post

Hi there, thanks so much for your help but I have solved it now! I put a border in the CSS so I could see where my div was being recognised from and to and from there worked out that the div was not being recognised from the area I pointed out and after about an hour of staring at the code I noticed that I had missed out a / in an img tag!

At least it will teach me to be more careful in future when typing in order to save myself hours of searching through the code! It also got me to notice the colour coding in my text editor that points out when there's a problem with the code (which I didnt notice before)- so it's not all bad :)

James Barnett
James Barnett
39,199 Points

Lisa -

I love it when people solve their own issues, rock on with your bad self :guitar:

So much of liking coding, enjoying feeling victorious when you squash a bug after a few hours of search and then all of a sudden, your code works.

My all time favorite CSS debugging technique is outline: solid red; as outlines don't take up space the same way borders do.

Most text editors that do syntax highlighting will also do tag matching, where you click on one tag and it shows you the matching tag. So if you notice your code highlighting looks wrong you can hunt around for which tag is missing it's other half.