
Design comparison
Solution retrospective
Figuring out how to do the image breakpoints. The picture
element was an interesting discovery.
The responsive image changes. I googled around and discovered the picture
element
Is there a different way to accomplish the picture switching?
For the button, how do you extend the button without padding?
Community feedback
- @jvssvjPosted 6 days ago
Hi Taylor, your solution was very good 👏. Regarding your question, yes, there are some ways to change the images, I will show you some examples:
- Using
Media Queries
. If the image is a background, you can set different images with background-image inside media queries:
.element { background-image: url("image-desktop.jpg"); } @media (max-width: 768px) { .element { background-image: url("image-mobile.jpg"); } }
- Using
picture
andsource
(for<img>
). If it's an image in theHTML
, you can use the<picture>
tag with<source>
to dynamically swap out the image:
<picture> <source srcset="image-mobile.jpg" media="(max-width: 768px)"> <source srcset="image-tablet.jpg" media="(max-width: 1024px)"> <img src="image-desktop.jpg" alt="Image description"> </picture>
- Using srcset in
<img>
. Another approach to responsive images is to use srcset on the<img>
:
<img src="image-default.jpg" srcset="image-mobile.jpg 768w, image-tablet.jpg 1024w, image-desktop.jpg 1920w" sizes="(max-width: 768px) 100vw, (max-width: 1024px) 50vw, 800px" alt="Image description">
These are just examples, you can change as you need, good luck friend.✌
Marked as helpful1 - Using
- P@milicaaa175Posted 6 days ago
Congrats on finishing the challenge, I think you did really good! There are only two things in your solution that are different from the design picture, but I think they are a quick fix:
- More padding is needed around the text portion of the card
- Color of the title is not right
Good luck on your next project!
Marked as helpful0
Please log in to post a comment
Log in with GitHubJoin our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord