I have recently updated to Google Chrome Version 72.0.3626.109 (Official Build) (64-bit)
in my mac and things are breaking now.
The reason behind having bit complex nested markup is because I need to show the image placed in centre of the div
respective of image being different size but proportionally resized inside square div. So, all this was working fine before updating to new google chrome.
.g-parent {
width: 150px;
}
.parent {
position: relative;
padding-bottom: 100%;
background-color: gray;
}
.child {
top: 0;
left: 0;
right: 0;
bottom: 0;
position: absolute;
padding-bottom: 100%;
}
.my-img {
width: 100%;
height: 100%;
display: block;
-o-object-fit: contain;
object-fit: contain;
}
<div>
<img class="my-img" src="https://dummyimage.com/400x200/000/fff" />
</div>
<h4>Show above image inside below div</h4>
<div class="g-parent">
<div class="parent">
<div class="child">
<img class="my-img" src="https://dummyimage.com/400x200/000/fff" />
</div>
</div>
</div>