D
D
dev4002016-05-19 18:45:24
css
dev400, 2016-05-19 18:45:24

How to resize an image on output?

Images of the product are displayed, all of them with different heights and widths. How can I make the pictures automatically zoom in and become 250x250? and were not distorted. Adaptability would also be nice to keep

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Schoolboy., 2016-05-19
@dev400

<div><img src=картинка.пнг></div>

div {
overflow: hidden;
width: 250px;
height: 250px;
}
img {
height:100%;
}

You can also make it a background, but then the search engines will not see it, which is bad

D
Denis Bukreev, 2016-05-19
@denisbookreev

For such purposes, it is necessary not to adapt the layout to the image, but to adapt the image to the design.
We take all the pictures and crop them properly. We put
a script on loading images so that new pictures are also cropped.
This is the best and most logical way, although it is a bit labor intensive at first.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question