The problem is that when using the transform property, the parent element ignores the increase in the size of the child element.
Example 1: Child container using width and height
.main { display: inline-flex; background: green; padding: 10px; } .element { display: block; background: red; width: 100px; height: 100px; } <div class="main"> <div class="element"></div> </div> Example 2: Child container using transform
.main { display: inline-flex; background: green; padding: 10px; } .element { display: block; background: red; width: 100px; height: 100px; transform: scale(1, 2); } <div class="main"> <div class="element"></div> </div> How to make transform take into account the parent container?