Lana Nova
Lana Nova

Reputation: 360

css disproportionate image scaling

I apologize for the noob question in advance.

What I would like to do is disproportionate scaling of an image. So if I have an image of 800x600px, I want it to be displayed as 100x100px. Before it worked to just set width and height on the img tag, however, now one of the properties is ignored and my blog entry looks lame.

Help?

Upvotes: 0

Views: 1140

Answers (1)

Martin Staufcik
Martin Staufcik

Reputation: 9490

Try setting background-size set to cover, this should perserve the scale, cover the whole area and crop areas that overflow:

background-image: url('image.png');
background-repeat: no-repeat;
background-size: cover;
width: 100px;
height: 100px;

Upvotes: 2

Related Questions