<!doctype html> <table> <tr> <td><div style="display: contents">foo</div></td> </tr> </table> <script> document.body.offsetTop; document.querySelector('div').style.color = "green"; </script>