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
Luqman Shah
3,016 PointsPadding Values on images won't work in media quarries, and how to scale images without interrupting content besides it?
.gazelle,
.map,
.hotel {
width: 40%;
height: 40%;
border: solid 2.5px grey;
padding-top: 2px;
padding-right: 2px;
padding-bottom: 2px;
padding-left: 2px;
}
So I tried to add borders with small amounts of padding around those 3 images, but for some reason it only applies padding to the top and left sides of the photos. I tried the shorthand property first, didn't work, then I tried it the longer way as shown above, still same unwanted results.
Also, I wanted to scale the images down so I scaled with width and height to 40%, then floated them. But they appear too small in mobile viewport width and height, and they appear too big in wider viewports, it's like they ignore all the margin and padding values I set so that there is some seperation between the photos and the content beside it. They don't honor the space besides them. How do I fix all this? Please take a look at my code through this fork method, thank you: (https://w.trhou.se/kjqoqodyvb)
1 Answer
jared eiseman
29,023 PointsGood way to enforce padding and make your images scalable is to give the images a width of 100% and give them a container div with it's width set to the size you want it. You can also give that container div some padding/margin (depending on the effect you're looking for). Might get you in the right direction.
Luqman Shah
3,016 PointsLuqman Shah
3,016 PointsThank you!! I added a maz-width of 100% then just scaled the image the way you mentioned. Also, my padding issues was because I had already added padding values in the media quarries. Thanks a lot Jared! (https://w.trhou.se/6pu4jt04w1)
jared eiseman
29,023 Pointsjared eiseman
29,023 Pointsnp, glad I could help.