How to make image start from top of the div and add border radius?

https://codepen.io/avinash-tallapaneni/pen/dygGrjR parent div of image is positioned display:absolute to its parent. so setting display:relative to the parent wont work. How should i proceed? Also since im using object-fit:contain how should i add border-radius to the image?
5 Replies
Monimolimnion
Monimolimnion3y ago
Can you clarify what you're trying to achieve?
Avinash
AvinashOP3y ago
each image is of different size, so im trying to make it fit to the top of the respective parentdiv
Monimolimnion
Monimolimnion3y ago
Then you need object-fit: cover rather than contain. And then put overflow: hidden on the parent to round the image too
Avinash
AvinashOP3y ago
if i do object-fit:cover the visible part of the image is very little and the user cant see the image.
Monimolimnion
Monimolimnion3y ago
Use smaller images

Did you find this page helpful?