HTML
<body>
<div id='el1'>
<div class='directChildren' style='width:50%;height:100px;float:left;margin-top:0'>
....
</div>
</div>
<div id='el2'>
<div class='directChildren' style='width:50%;height:100px;float:right;margin-top:20px'>
....
</div>
</div>
<div style='clear:both'/>
</body>
JS
const topEl1 = document.getElementById("el1").getBoundingClientRect().top; // return 0 (only example)
const topEl2 = document.getElementById("el2").getBoundingClientRect().top; // return 20 (topEl1 + margin top of el2)
QUESTION: Both of divs (el1, el2) has same top coordinate but why getBoundingClientRect return different ?. This case also happen for margin-bottom.