<!DOCTYPE html> <html> <head> <style> .nav { display: table } .nav:after { content: " " } </style> </head> <body> <div style="font-size: 1rem"></div> <div class="nav"> </div> <script> document.documentElement.style.fontSize = "10px"; document.documentElement.offsetHeight; document.documentElement.style.fontSize = "15px"; </script> </body> </html>