Answer the question
In order to leave comments, you need to log in
Why does Safari not change the image on all planes (height and width), but only on clearly defined ones?
Hello!
There is a block
<div class="box-logo">
<img class="logo" src="logo.png">
</div>
.logo {
position:relative;
top:15%;
height:70%;
transition:100ms ease;
-webkit-transition:100ms ease;
}
box-logo
in js
, the logo image is reduced only in height, although the default width auto
should fit itself, but the width remains the same as before, when it was higher in size, how to fix this in Safari? In other browsers everything works fine.
Answer the question
In order to leave comments, you need to log in
You can try adding max-height
and max-width
.
But, IMHO, this structure is better:
<div class="box-logo">
<div class="logo"><img src="" alt=""></div>
</div>
img {
display: block;
width: 100%;
height: 100%;
object-fit: contain; // опционально
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question