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

Y B
Y B
14,136 Points

Build a website course - wrapper challenge

I'm currently on 'how to make a website' course but for some reason can't get past the CSS make a wrapper challenge.

It asks for: Select the ID wrapper, set it to a max width of 940 pixels, and then center it on the page using the margin property.

I have put:

wrapper {

max-width: 940px; margin: 0 center;

}

but it doesn't seem to work unfortunately?

Y B
Y B
14,136 Points

Sorry please ignore I manage to solve it changing it to auto rather than center

3 Answers

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,252 Points

Hello there,

To select an element with an id you need to use the # front of the id name.

#wrapper {

max-width: 940px; margin: 0 center;

}

Use the pound (#) character and it should select the element that has that ID.

Incidentally don't forget to check out the Markdown Cheatsheet https://teamtreehouse.com/forum/build-a-website-course-wrapper-challenge# for adding code to these forums. :)

Y B
Y B
14,136 Points

Thanks that bit was just cut off for some reason in the formatting. Is there a way to format CSS code in the forum?

Jonathan Grieve
Jonathan Grieve
Treehouse Moderator 91,252 Points

It's a bit tricky to show in the forum without it actually doing it..

but basically if you type 3 backticks ` and css to name the type of code you want to display and close with 3 more backticks it'll format your code in CSS.

I've just noticed the link to the markdown didn't work. :)

So here's what it says about adding code.

```Wrap your code with 3 backticks on the line before and after. If you specify the language after the first set of backticks, that'll help us with syntax highlighting.

        ```html
        <p>This is code!</p>
        ```
Y B
Y B
14,136 Points

Perfect thanks

Kirill Fedotov
Kirill Fedotov
3,809 Points

I think it's better to use

margin: 0 auto;

instead of

margin: 0 center;