Consider you have a page (yellow background), with an element (grey line) that has a child element (dotted red); all the same pixel dimensions. The grey parent is scaled up to 1.5, which naturally makes its child also scaled up. To reverse the size of the child, visibly, to 1.0, I set the child's scale to 0.5. I expected the child to revert to a non-transformed 1.0 visually, but it does not. If I increase the scale of the child to 0.66, it appears non-transformed as intended. Is there any logic to apply here? To programmatically reverse the scale of a child element when its parent is scaled up? Thanks!
#region, #scaled-up, #scaled-down {
position: relative;
width: 200px;
height: 100px;
}
#region {
background-color: yellow;
margin: 50px auto;
}
#scaled-up {
-webkit-transform: scale(1.5);
transform: scale(1.5);
}
#scaled-down {
-webkit-transform: scale(0.5);
transform: scale(0.5);
}
#scaled-up::before, #scaled-down::before {
content: '';
position: absolute;
width: calc(100% - 4px);
height: calc(100% - 4px);
}
#scaled-up::before {
border: 2px solid grey;
}
#scaled-down::before {
border: 2px dotted red;
}
<div id="region">
<div id="scaled-up">
<div id="scaled-down"></div>
</div>
</div>