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
jurgen wolf
Courses Plus Student 2,451 PointsChallenge Task 1 of 4 Add CSS that will allow all images to fill their parent element. Can anyone help??
I'm stuck, because i dont know what exactly this means
7 Answers
Courtney Clark
12,270 PointsMaybe you have to get the width and height of the parent and setting the img tag style to those values
jurgen wolf
Courses Plus Student 2,451 Pointsi dont know thatswhy im asking
jurgen wolf
Courses Plus Student 2,451 Pointsthanks for your quick answer
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; }
Jeff Jacobson-Swartfager
15,419 PointsIf you are on the code challenge for Styling Web Pages and Navigation, you'll need to set the max-width property on img elements. The idea is to make sure that images are always 100% the size of their parent element or smaller.
img { max-width: THE VALUE GOES HERE; }
jurgen wolf
Courses Plus Student 2,451 Pointsthanks
but what is my parent element??
Jeff Jacobson-Swartfager
15,419 PointsIt doesn't matter. All you need to know that the img element has one (at the very least, it is the body element).
You don't need to worry about which element is the img's parent element (or, in other words, which element contains the img). You just need to make sure that width of each img is the same or less than the width of the parent element.
You may find it helpful to review the MDN doc on the max-width property. Check out how the various values are calculated.
Courtney Clark
12,270 PointsI think you can actually just use '100%' as your value
jurgen wolf
Courses Plus Student 2,451 Pointsthanks
i used 100% and it worked fine
thanks for the fast response- you guys rock