Как изменить размер и изменить положение изображения внутри коробки таким образом, чтобы он охватывал весь блок, аналогичный тому, как работает background-size: cover
.
<div class="box" style="width: 100px; height: 100px;">
<img src="pic.jpg" width="413" height="325">
</div>
Я знаю, что мне нужно добавить overflow:hidden
в поле, а изображение нужно position: absolute
. Но какая формула дает мне правильный новый размер для изображения, а слева + верхние позиции?