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

I need Help

I don't know what the answer to this code challenge is, please help

Stone Preston
Stone Preston
42,016 Points

can you post the code you have tried so far?

This question is ADD CSS THAT WILL ALLOW YOUR IMAGES TO FLOW THE PARENT ELEMENT

after i do it keep asking for max-wdith

Here MOD

gallery li {

float: left; width: 45%; margin: 2.5%; }

this is one thing i tried and i need to add try more and more

Here MOD

gallery li {

float: left; width: 45%; margin: 2.5%; }

this is one thing i tried and i need to add try more and more

3 Answers

Stone Preston
Stone Preston
42,016 Points

you are going to need to select images using

img {

}

and then add a rule that makes the element fill the parent elements width (hint you need to use the max-width attribute and set it with a percentage). It needs to fill the TOTAL WIDTH of the parent element.

I tried this it didn't work, and keeps asking for a max-width, when i put it. IT says that It doesn't fill the parent element

Stone Preston
Stone Preston
42,016 Points

ok what values are you using for max width.

I tried 100%

Stone Preston
Stone Preston
42,016 Points

post the entire code you tried. 100% is the correct value so it must be something else that is incorrect

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 { max-width: 100%; margin: 45%; padding: 2.5% }

Actually NVM i got it. Thank You sir!

Stone Preston
Stone Preston
42,016 Points

you dont need to set the margin and padding for the img selector. all you need is the max width.

TY