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

Image size doesn't change when resizing browser, Why? (for personal project)

Hello, In body I have the header, two div tags and a footer In the second div I have three section tags in which I have an ul with 8 li each have an a tag with an img and a p tag just like in the course.

I'm using the max-width: 100%; and height: auto; also but nothing, the image doesn't change, they just keep pushing each other under.

I add the html code for the list and the css which corresponts to it, any idea how to fix this?

<section class="third"> <ul id="produse"> <li> <a> <img src="img/JaluzeleVerticale_02.png" alt="Jaluzele Verticale"> <p>Jaluzele Verticale</p> </a> </li> <li> <a> <img src="img/JaluzeleOrizontale_02.png" alt="Jaluzele Orizontale"> <p>Jaluzele Orizontale</p> </a> </li> <li> <a> <img src="img/RulouriExt_02.png" alt="Rulouri Exterioare"> <p>Rulouri Exterioare</p> </a> </li> </ul> </section>

CSS

.third { padding: 0 5%; margin: 0 auto; width: auto; }

produse {

flex: auto;
margin: 0;
padding: 0;
list-style: none;
width: auto;

}

produse li {

float: left;
width: auto;
margin-bottom: 15px;
margin-left: 1.95%;
margin-right: 1.95%;
background-color: #6699FF;
color: black;

}

produse li a {

padding: 0;

}

produse li a img {

max-width: 100%;
height: auto;

}

produse li a p {

margin: 2px;
font-size:  0.75em;
color: black;
text-align: center;

}

3 Answers

Hey Erik Are you using the # to indicate the id 'produse' in your CSS. For example #produse {flex: auto; margin: 0; padding: 0; list-style: none; width: auto; }

Hi Erik,

I believe you need to specify the size of the parent element (produse) as your images have nothing to compare their max-width:100% in order to make them responsive. Otherwise, they will just be keep max-width:100% of the next specified width (or the <body> tag if nothing else is specified.)