Design comparison
Solution retrospective
Code is pretty readable and stylesheet is not very long.
What challenges did you encounter, and how did you overcome them?The spacing between the paragraph and the price seemed to be variable so the button could be all the way down to the padding of the "card". I split the text and the price and button into two divs and used justify-content: space between to fix it.
What specific areas of your project would you like help with?I would like to get away from wrapping the text and price with button in divs in order to justify the spacing between them.
Community feedback
- @danielmrz-devPosted 7 months ago
Hello @RegexRiddler!
Your project looks great!
I have a suggestion about your code that might interest you:
š You can use the
<picture>
tag when you have different versions of the same image.Using the
<picture>
tag will help load the correct image to the user's device, saving bandwidth and improving performance.Example:
<picture> <source media="(min-width: 768px)" srcset="{desktop image path here}"> <img src="{mobile image path here}" alt="{alternative text here}"> </picture>
I hope this helps!
Other than that, excellent work!
Marked as helpful0@RegexRiddlerPosted 7 months ago@danielmrz-dev That's great feedback! Thank you :)
As a reference for those seeing your suggestion, this is my original solution:
// HTML <img class="product-image" src="./images/image-product-mobile.jpg" alt="perfume bottle among green leaves"> // CSS @media (min-width: 632px) { .product-image { content: url(./images/image-product-desktop.jpg); width: 300px; border-radius: 10px 0 0 10px; } }
This always loads the mobile image, and only at larger screens does it load the desktop image. Daniel's suggestion allows for more semantic markup and only loads either mobile or desktop image based on screen size.
0
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