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.

CSS

I can't make max-width and margin 0 work in main.css center css. I use Windows ??

lesson center css wrap in main.css --- I am at the part of div to remove text decoration. That worked !! Now I am trying to center the pages using max-width 940px; with a margin of 0(zero) auto; that is not happening --when I add background: orange; that is not happening either ??? Any suggestions

10 Answers

Can you please paste the code that you are trying to submit so we can have a better idea of how to help you? :)

a { text-decoration: none; }

wrapper {

max-width: 940px; margin: 0 auto; background: orange; }

```htmla { text-decoration: none; }

wrapper {

max-width: 940px; margin: 0 auto; background: orange; }```

You are missing the # sign in the wrapper selector to refer to the wrapper id I believe.

when I tried to copy/paste, the hashtag did not show up, so i put html and and copied/paste, it still does not show up here, but it is in my code.

Also the second question isn't asking for the background to be made orange! Make sure to only answer the question! :)

The answer is:

a { text-decoration: none; }

#wrapper {
    max-width: 940px;
  margin: 0 auto;
}

```html a { text-decoration: none; }

wrapper {

max-width: 940px; margin: 0 auto; background: orange; }```

Patrice, that isn't HTML! That is CSS. Therefore it's not formatting it for you. I showed you your mistake. 1) You forgot to use the # sign in the wrapper selector, and 2) You tried to make background orange, even though it was not asked! Hope it helped. :)

Sarunas, I am so new at this, that I am driving myself crazy !!! What I typed for code is exactly what is on the video, so I do not understand what is wrong? What is the background supposed to say if I want it to be Orange ???

Sorry, maybe I misinterpreted what you were trying to do. I thought you are doing the code challenge. To make the background orange you would do what you did, but you need to make sure the wrapper has the # sign in front of it, as it is an ID which references your markup.

a { text-decoration: none; }

#wrapper {
    max-width: 940px;
    margin: 0 auto;
    background-color: orange;
}

OK, interesting --- Nick (teacher) said don't need to put background- color, just use shortcut ---- So what you are showing me is what I will try to do --- now-what do I need to do to correctly send over my code in css ??? tried exactly what you showed and still not working --- and yes, I put in the #.

Are you doing the code challenge? If yes, then you don't need the background-color: orange; part because the code challenge isn't asking for that.

Kang-Kyu Lee
Kang-Kyu Lee
52,045 Points

Hi Sarunas and Patrice.. Usually when I tried, code challenges would not be failed even if there's additional lines. (unless that additional code makes some errors) however, in my guess, the html tag with id="wrapper" can be somehow not right.

Yes, that's right. If Patrice is doing the code challenge he needs to make sure he ONLY answers the question given to him. If it's the code challenge the right answer is:

It can't be the HTML because he doesn't have access to it in the codechallenge.

a { text-decoration: none; }

#wrapper {
    max-width: 940px;
    margin: 0 auto;
}

Kang and Sarunas ----- I thank you both, I am not at the challenge -- I am still in the "class", with Nick. What he said to do I did and it did not happen. Please, tell me what little secret I need in the file folder main.css that will allow me to get my code posted to you two, so you can help me !!

To type the code just type three backticks "```" and then type css.

Remember that you can download the project files from nick to your computer and compare his code to your own!

Kang-Kyu Lee
Kang-Kyu Lee
52,045 Points

Okay, so you're working on workspace and probably watching Center the Wrapper video. Checking if put id="wrapper" at the right place while watching Use ID Selectors (right previous) video?

:)

Kang, I am watching the CSS: Cascading Style Sheets video -- lesson 1 -- center the wrapper. The teacher is in main.css and says to input the following hashtagwrapper and right curly-cue symbol} then type max dash widthcolonspace940px; margin: 0 auto; this will center the pages I have already created it did not happen

he does not show to use idequal"wrapper" but I tried that and it did not work either

Sooooo, what do I do to send my code over for you to look at copy and paste don't seem to work and ```html is the wrong thing, so can you help me ???

Checked again --yes id=wrapper is in the right place on the index.html section. Then switched over to main.css. That is where I am having the problem :(

Kang-Kyu Lee
Kang-Kyu Lee
52,045 Points

Forgive me, but your CSS code was very correct to me. Could you please double-check? There should be quotation mark around like this:

<div id="wrapper">
</div>