Frontend-Mentor-Preview-Card

Solution retrospective
I have struggled with the images and I cant seem to fit them very well. Can anyone lend me a hand with that ?
Please log in to post a comment
Log in with GitHubCommunity feedback
- @0xabdulkhaliq
Hello there 👋. Congratulations on successfully completing the challenge! 🎉
- I have other recommendations regarding your code that I believe will be of great interest to you.
iMAGES 📸:
- You can use the
<picture>
tag instead of settingimages
to background when you have different versions of the sameimage
. The<picture>
HTML element contains zero or more<source>
elements and one<img>
element to offer alternative versions of an image for different display/device scenarios.
- Using the <picture> tag will help you to load the correct image for the user's device saving bandwidth and improving performance. You can read more about this here.
Example :
<picture> <source media="(max-width: 500px)" srcset="./images/image-product-mobile.jpg"> <img src="./images/image-product-desktop.jpg" alt="alt text goes here"> </picture>
.
I hope you find this helpful 😄 Above all, the solution you submitted is great !
Happy coding!
Marked as helpful - @Petrosdevri
Hey there, nice work and congrats for completing the project!
A few notes on your solution:
- Try changing the
width
of yourmain
element to a smaller value in order to ensure that both images and text display in harmony. By setting it toauto
you basically enable the browser to render it with issues (for example the image won't appear well if you zoom to 100%). I personally chose to wrap these elements inside a.product-preview
div
after themain
element and set awidth
of550px
and aheight
of400px
, which I of course changed for smaller devices by reducingwidth
and increasingheight
respectively.
In conclusion, your project seems to be decent and by working on various details and practicing frequently you will be able to achieve even better results.
Marked as helpful - Try changing the
Join 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