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![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Sean Amador](https://secure.gravatar.com/avatar/ae46e4e0cbf9f672a9ad85ad51b85db3?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Sean Amador
500 PointsI'm stuck on the "How to Make a Website" Code Challenge "Add CSS that will allow all images to fill their parent element
I can't figure out what to do for the code challenge in "How to Make a Website" asking me to "Add CSS that will allow all images to fill their parent element." There there is no index.html to find out what the parent element was called in the code. I tried #gallery however it didn't work.
Thank you in Advance for any advice you can give.
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;
}
3 Answers
![Ron McCranie](https://secure.gravatar.com/avatar/daf02aa9bf168737d31e032fd83599a7?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Ron McCranie
7,837 PointsThe instructions mention "all images" in this case you don't have to have a class or id you can just use the img
element selector like this:
img {
max-width: 100%;
}
![Grace Kelly](https://uploads.teamtreehouse.com/production/profile-photos/651222/micro_IMG_20150725_181534_4.jpg)
Grace Kelly
33,990 PointsHi Sean, in order to target all images you use 'img', and to ensure they fill the parent element that they are contained in you set a max width of 100%, like so:
img {
max-width: 100%;
}
So say you set a div with a width of 500px, the image inside of this div will also be 500px
![Sean Amador](https://secure.gravatar.com/avatar/ae46e4e0cbf9f672a9ad85ad51b85db3?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Sean Amador
500 PointsGot it thank you guys! I was referencing the #gallery tag used earlier.