<div>
<div style="display: inline-block; height: 0; width: 50px;">
<div style="width: 50px; height: 50px; background-color: green;"></div>
</div>
<div id="float" style="float: left; height: 50px; width: 50px; background-color: red;"></div>
</div>
<script>
document.body.offsetTop;
document.getElementById("float").style.display = "none";
</script>