JSFiddle - React, Tailwind, and code Playground
HTML
<div>
<span>Test</span>
</div>
<div>
<span>Test</span>
</div>
CSS
div {
display: inline-block;
width: 200px;
border:solid 1px;
}
div:nth-child(2) {
transform:translateY(2em);
}
div:nth-child(2) span{
position:fixed;
}
JavaScript
$( "div" ).each(function() {
var a = $(" span",this).offset().top;
$(" span",this).html(a);
$(" span",this).css("top",a+"px");
});