I'm using scale function so when I hover the div the image and text inside it grow. On chrome browser it works perfectly but on mozilla the div grow too. How can I fix that ? I never had to fix browser compatibility problems before so I don't know where to start.
<div class="zoom-in">
<a href="#">
<img src="https://via.placeholder.com/150">
</a>
<h2><a href="#"><span>My Text</a></h2>
</div>
.zoom-in {
-webkit-transition: all 0.2s ease;
-moz-transition: all 0.2s ease ;
-ms-transition: all 0.2s ease ;
-o-transition: all 0.2s ease ;
transition: all 0.2s ease ;
}
.zoom-in:hover {
-webkit-transform: scale(1.1);
-moz-transform: scale(1.1);
-ms-transform: scale(1.1);
-o-transform: scale(1.1);
transform: scale(1.1);
}
SOLUTION : Finally I decided to use specific CSS code for mozilla browser only
.zoom-in {
-webkit-transition: all 0.2s ease;
-ms-transition: all 0.2s ease ;
-o-transition: all 0.2s ease ;
transition: all 0.2s ease ;
&:hover {
-webkit-transform: scale(1.1);
-ms-transform: scale(1.1);
-o-transform: scale(1.1);
transform: scale(1.1);
}
}
// Mozilla browser only
@-moz-document url-prefix() {
.zoom-in {
max-width: -moz-fit-content;
&:hover {
transform: none;
}
&:hover img,
&:hover h2 {
-moz-transition: all 0.2s ease ;
-moz-transform: scale(1.1);
}
}
}