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 trialMatthew Cahn
6,301 PointsNot 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?
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%
}
Lukas Coffey
20,382 Points^^ 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.
Wayne Priestley
19,579 PointsWhat 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%;
}
Lukas Coffey
20,382 PointsOh you're talking about the challenge, my bad. I'm thinking in terms of a user stylesheet, thanks for clarification.
3 Answers
Hugo Paz
15,622 PointsHi Matthew,
You need to set the max-width:100%
Lukas Coffey
20,382 PointsHello 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.
Matthew Cahn
6,301 PointsThanks, figured it out myself.
Wayne Priestley
19,579 PointsWayne Priestley
19,579 PointsYour also missing the semicolon after 100%