1
I have a problem. When using scale()
in a CSS of mine to decrease the size of an image in media query, he’s creating a padding
mysterious.
This padding
is not set anywhere, if you see, it is the original image size. The image decreases, but the parent element retains the original size. He shouldn’t be around?
I made a codepen with the codes to view the codes and the application.
.container {
border:1px solid purple;
}
.linha-03 {
background:#00356e;
padding:45px 0;
margin-bottom:10px;
}
.linha-03 ul {
list-style:none;
padding:0;
margin:0;
}
.linha-03 ul li {
float:left;
margin-right:55px;
border:1px solid red;
}
.linha-03 ul li:last-child {
margin:0;
}
.linha-03 ul li img {
border:1px solid green;
}
@media (min-width:992px) and (max-width:1199px) {
.linha-03 ul li img {
transform:scale(0.8);
}
}
@media (min-width:768px) and (max-width:991px) {
.linha-03 ul li img {
transform:scale(0.5);
}
}
<div class="linha-03">
<div class="container">
<ul>
<li><img src="http://placehold.it/203x48"></li>
<li><img src="http://placehold.it/169x48"></li>
<li><img src="http://placehold.it/137x48"></li>
<li><img src="http://placehold.it/66x48"></li>
<li><img src="http://placehold.it/156x48"></li>
<li><img src="http://placehold.it/101x48"></li>
</ul>
</div>
</div>
<link rel='stylesheet' href='//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css'>
I believe it is the default padding of the browser, for example Chrome it has default margin of it the firefox no... you know? maybe it is that tries to put the
padding: 0;
– Nathan
@Nathan, I tested this, obviously. No result. I tried to reset the padding, margin of all the elements above the image.
– Maykel Esser
It’s not that he’s creating a mysterious padding. The point is that he’s padding the image, not the element that surrounds the image. Then he’ll do just that. He won’t keep up. But if you do the Scale on the father, it works.
– Diego Souza