Mentle Storier
Mentle Storier

Reputation: 43

round div with a img inside width<height height<width HTML / CSS

so i have a round div with a img inside. The problem is:

#mydiv
{
width: 50px;
height: 50px;
overflow: hidden;
border-radius: 25px;
}

Now, if a user uploads a picture with less height than width i can take height: 50px and width: auto;

but if a user uploads a picture with less width than height i need to make height: auto; and width: 50px;

If its wrong, the div isnt filled with this img.

How i can solve it?

sorry, im pupil in germany so i cant write well :/

Upvotes: 0

Views: 430

Answers (1)

TOMAZKI
TOMAZKI

Reputation: 23

Put the image in css :

background: url(img/...) no-repeat center center; background-size: cover;

That's the way !

Upvotes: 2

Related Questions