JSFiddle - React, Tailwind, and code Playground

by Koubenec

HTML

<div class="jsbar">This is dynamically created</div>
<div class="page">
    <header>The header bar</header>
   <div class="content">the content here </div>
</div>

CSS

.page {
    background:#f8f8f8;
    height:900px;
    /*margin-top: 100px;*/
}
header {
    position:fixed;
    top:0px;
    background:#eee;
    height:10px;
}
.jsbar {
    position: fixed;
    top: 0px;
    background:#ccc;
    height:40px;
}

JavaScript

var finder = document.getElementsByTagName("div")[0];
var findrheight = finder.clientHeight;
var main = document.getElementsByTagName("header")[0];
main.style["margin-top"] = findrheight+"px";