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 trialJainil Patel
1,653 PointsI need Help
I don't know what the answer to this code challenge is, please help
Jainil Patel
1,653 PointsThis question is ADD CSS THAT WILL ALLOW YOUR IMAGES TO FLOW THE PARENT ELEMENT
after i do it keep asking for max-wdith
Jainil Patel
1,653 PointsHere 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
Jainil Patel
1,653 PointsHere 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
42,016 Pointsyou 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.
Jainil Patel
1,653 PointsI 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
42,016 Pointsok what values are you using for max width.
Jainil Patel
1,653 PointsI tried 100%
Stone Preston
42,016 Pointspost the entire code you tried. 100% is the correct value so it must be something else that is incorrect
Jainil Patel
1,653 Pointsa { 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% }
Jainil Patel
1,653 PointsActually NVM i got it. Thank You sir!
Stone Preston
42,016 Pointsyou dont need to set the margin and padding for the img selector. all you need is the max width.
Jainil Patel
1,653 PointsTY
Stone Preston
42,016 PointsStone Preston
42,016 Pointscan you post the code you have tried so far?