<div id="fix"> This is a very long sentence, very very very long. And I have more to say about this very long sentence. Hope you don't get bored.</div>
<div id="content">We can see the content.</div>
div{
  font-size:20px;
  font-family:sans-serif;
  color:white;
}
#fix{
  background:red;
  position:fixed;
  top:0;
}
#content{
  background:green;
  height: 100px;
}

function dynamicHeight(){
  $('#content').css("margin-top", $('#fix').height());
}
$(document).ready(dynamicHeight);
$(window).resize(dynamicHeight);

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

  1. https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js