S
S
swcalc2015-05-12 02:02:19
css
swcalc, 2015-05-12 02:02:19

How to resize images with css?

There are divs with percentage height and width, how to fit the image so that it has a width and height not exceeding the values ​​from the divs?
Preferably in pure css. Thanks in advance!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey delphinpro, 2015-05-12
@swcalc

background-size: contain;
or if the picture

img {
max-width:100%;
max-height:100%;
}

A
Andrew, 2015-05-12
@Ashlst

max - width, max - height

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question