<div style="position: relative; width: 200px; border:solid; height: 20px">
    <div id="inner" style="right: 0; position: absolute;">text</div>
</div>
<script>
    document.body.offsetTop;
    inner.innerText="longertext";
</script>
