.child { display: block; position: fixed; top: 15px; left: 15px; padding: 25px; background: #5fba7d; color: #fff; font-size: 24px; } .paren { height: 5000px; } body { transform: scale(0.95); } 
 <div class="paren"> vrtvrtv <br>trvrvr <br>vrvrv <br>vrtvr <br>v <br>rfrv <br>r <br>v <br>r <br>v <br>r <br>v <br>v <br> <br> <div class="child"> Это плавающий блок </div> </div> 

Here is an example of code where the body has transform: scale because of this elements with position: fixed; cease to be fixed in a certain part of the window. so looking for a working alternative, without using js you can still reduce the element

  • Did my answer fit you? If so, mark it as accepted. If not, specify what you need in the comments. - Vadim Ovchinnikov

1 answer 1

Set all dimensions instead of px either in rem (I recommend this method because of its simplicity and maintainability, then the measurements will be relative to the font-size html tag), or in em (then the measurements will occur relative to the font-size current element).