Design comparison
Solution retrospective
Please help me to improve my code. Thanks!
Community feedback
- @dwhensonPosted almost 3 years ago
Hey @Prabhat-kumar-1976 - Lovely job here! š„³
I can see that your image is getting a bit squashed. One super useful property to help with this is
object-fit:cover
if you add that to your image it should help. It's worth exploring that property a little as it's helped me loads when dealing with images.One other tip is to always wrap an
img
in adiv
or some other element if you want to make it a flex-child. Images seem to act strangely when they are direct children of an element withdisplay: flex
.Lastly, you can remove the flex setting from the image itself - this doesn't do anything as it only has an impact on an elements children, and and image doesn't have children! If you need so set an images display property, it is nearly always
block
, withmax-width:100%; height: auto
.Hope this helps a little and keep up the good work!
Cheers š Dave
1@Prabhat-kumar-1976Posted almost 3 years agoDear @dwhenson , Thanks a lot for your helpful advice especially your
object-fit:cover
advice0
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