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 How to Make a Website CSS: Cascading Style Sheets Use ID Selectors

Nathan Watkins
Nathan Watkins
4,696 Points

max-width does not change

Whenever I try to change the max-width in my main.css stylesheet, it does not affect anything. Here's my code with the main.css stylesheet at the bottom.

<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Nate | Site</title> <link rel="stylesheet" href="css/normalize.css"> <link rel="stylesheet" href="css/main.css"> </head> <body> <header> <a href="index.html"> <h1>Nate Watkins</h1> <h2>Website</h2> </a> <nav> <ul> <li><a href="index.html">Portfolio</a></li> <li><a href="about.html">About</a></li> <li><a href="contact.html">Contact</a></li> </ul> </nav> </header> <div id="wrapper"> <section> <ul> <li> <a href="img/numbers-01.jpg"> <img src="img/numbers-01.jpg" alt=""> <p>Experimentation with color and texture</p> </a> </li> <li> <a href="img/numbers-02.jpg"> <img src="img/numbers-02.jpg" alt=""> <p>Caption 2</p> </a> </li>
<li> <a href="img/numbers-02.jpg"> <img src="img/numbers-02.jpg" alt=""> <p>Caption 3</p> </a> </li>
<li> <a href="img/numbers-02.jpg"> <img src="img/numbers-02.jpg" alt=""> <p>Caption 4</p> </a> </li>
<li> <a href="img/numbers-02.jpg"> <img src="img/numbers-02.jpg" alt=""> <p>Caption 5</p> </a> </li>
</ul> </section> <footer> <a href="http://facebook.com"> <img src="img/facebook-wrap.png" alt="Facebook Logo"> </a> <a href="http://twitter.com/swatkinsvu"> <img src="img/twitter-wrap.png" alt="Twitter Logo"> </a> <p>Ā© Nate Watkins, 2016</p> </footer> </div> </body> </html>

body {
  background-color: #c2d6d6;
  color: white;
}
a {
  text-decoration: none;
}
#wrapper {
  margin: 0 auto;
  padding: 0 5%;
  background: red;
  max-width: 940 px
}

2 Answers

David Bath
David Bath
25,940 Points

Why do you have a backslash before #wrapper? If that's in your actual code it could be breaking the selector. But probably it's broken because you have a space between 940 and px.

Nathan Watkins
Nathan Watkins
4,696 Points

I added the backslash was because it was not initially showing up as code on here and causing some strange formatting. The space was the answer. Rookie mistake.

David Bath
David Bath
25,940 Points

Typos happen. It's good to get another set of eyes on the code sometimes.