I am attempting to create a website layout with a header at the top that has a dynamic height but remains fixed in position, followed by a content area. My initial approach involved adding a fixed padding-top to an element in order to display the content below the header, using JavaScript and JQuery. Although I believe this method is ideal, it seems to be not fully functional.
[HTML]
<div class="contentPage" id="page_1" name="templates">
<div class="contentPageHeader">
<a href="#menu">
<div class="pageBack">
<h4>Back</h4>
</div>
</a>
<h3>Templates</h3>
</div>
<div class="contentPageContent">
</div>
</div>
[JS]
var headerHeight = $('.contentPageHeader').css( 'height' );
$('contentPageHeader').css('margin-top', headerHeight);
To see a demonstration, please visit this JSFiddle link