Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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