<!DOCTYPE html>
<body style="color: red">
  <div id="x" style="display: inline; visibility: hidden">
    Line 1
    <div>Line 2</div>
    Line 3
    <div>Line 4</div>
    Line 5
  </div><script type="text/javascript">
    document.body.offsetWidth;
    document.getElementById("x").style.visibility = "visible";
    document.body.style.color = "green";
  </script>
</body>