Answer the question
In order to leave comments, you need to log in
Why are picture sizes not the same as img sizes?
I'm using picture to insert a responsive image.
But often the height or width of the picture does not match the dimensions of the img.
The img has the sizes set, the picture has nothing in the styles.
For example, in such situations, problems arise with the centering of the image in the block.
<picture>
<source media="(min-width: 1440px)" srcset="img/logo-desktop.svg" width="202" height="59">
<source media="(min-width: 768px)" srcset="img/logo-tablet.svg" width="174" height="52">
<img class="logo__img" src="img/logo-mobile.svg" width="34" height="auto" alt="">
</picture>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question