<body onload="test()">
    <div style="font-family: Ahem; font-size: 50px; color: red;">
        <span id="float" style="float: left; color: green;">Y</span>Z
    </div>
    <script>
        function test()
        {
            document.body.offsetTop;
            document.getElementById("float").style.position = "absolute";
        }
    </script>
</body>
