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 trialAlexander Ulbashev
10,130 PointsHello! I don't understand why do you use this trick for featured image. Why are you not using CSS for img(heigth: auto)
Why do you use variables rather than add one simple rule in CSS ? item img { width: 100%; height: auto; }
1 Answer
Nicole Carvalho
8,416 PointsI agree with you. Here's my css:
.portfolio-piece { text-align: center; }
@media (min-width:768px) {
.portfolio-piece img {
max-width: 100%;
height: auto;
}
}
The images look much better on a smaller screen width and the code is less complex. Hope this is a good alternative than what they discussed in the video.
Motoki Higa
14,111 PointsShould mark as best answer ay! Thanks for sharing
Nate Allen
2,385 PointsNate Allen
2,385 PointsYou're correct. You can just add
height: auto
to make the image responsive.