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 How to Make a Website CSS: Cascading Style Sheets Center the Wrapper

For some reason #wrapper is highlighted in red and when I finished the coding and refreshed it doesn't change anything?

The text for "#wrapper" remains highlighted in red and doesn't change to a normal text color when I finish writing it, and as a result I believe it affects the coding from not changing after being refreshed.

2 Answers

Charlie Knight
Charlie Knight
4,338 Points

I'm going to assume you are using Treehouse Workspaces? In workspaces, the text color of CSS properties indicated in red. This is just a visual aid - and doesn't necessary mean there is an error. If the text is highlighted, it usually means a problem with the syntax (such as a missing ':'

Double check all of your code. Do you have a id or a class that references to the wrapper and is it spelt correctly. Are you sure the style sheet is linked correctly and finally is the syntax correct?

Here's a rough draft of what it should look like.

In your CSS File:

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

In the HTML File:

<html>
  <link rel="stylesheet" href="test.css">
  <body>
    <div id="wrapper">
        <p>Test</p>
    </div>
  </body>  
</html>

If you click the preview on that code, then a change should be noticed. If your code still isn't working, post it here so I can take a look.

Hope this helps.

Thanks Charlie! I figured it out. I forgot to use a closing curly brace...and instead had an open curly brace. Much appreciated for the assistance! :)