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 Styling Web Pages and Navigation Make a CSS Image Gallery

Not sure what you want me to do. Here's my code: img { width: 100% } What did I do wrong?

The images in the example fill the element. What did I do wrong?

css/main.css
a {
  text-decoration: none;
}

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

#logo {
  text-align: center;
  margin: 0;
}

h1, h2 {
  color: #fff;
}

nav a {
  color: #fff;
}

nav a:hover {
  color: #32673f;
}

h1 {
  font-family: โ€˜Changa Oneโ€™, sans-serif;
  font-size: 1.75em;
  font-weight: normal;
}

img {
  width: 100%
}

Your also missing the semicolon after 100%

^^ True. Because it's at the end of the declaration it won't affect the output, but if you add anymore properties, it will make all of those invalid.

What do you mean

it's at the end of the declaration it won't affect the output

it won't pass the challenge unless its added, like this.

img {
  max-width: 100%;
}

Oh you're talking about the challenge, my bad. I'm thinking in terms of a user stylesheet, thanks for clarification.

3 Answers

Hi Matthew,

You need to set the max-width:100%

Hello Matthew,

When you specify width: 100% for an element, it will always span 100% of it's containing element. Setting your width to max-width: 100% will allow it to only span the width of the element and not go any larger. Setting max-width is what they want you to do.

Thanks, figured it out myself.