JSFiddle - React, Tailwind, and code Playground

HTML

<div class=parent>
    <div class=child>
        Absolute child
    </div>
    Some content of the parent div<br />
    with variable height
</div>
<div class="parent fixed">
    <div class=child>
        Absolute child
    </div>
    Some content of the parent div with fixed height to show off how it is supposed to look like
</div>

CSS

.parent {
    position: relative;
    left: 100px;
    top: 100px;
    background: rgba(255, 0, 0, 0.2);
    padding: 20px;
    display: inline-block;
}

.parent.fixed {
    width: 225px;
    height: 80px;
    padding: 0px;
    left: 250px;
}

.child {
    position: absolute;
    right: 100%;
    top: 50%;
    margin-top: -50%;
    background: rgba(0, 0, 255, 0.2);
    display: inline-block;
}

.parent.fixed > .child {
    height: 40px;
    top: 40px;
    margin-top: -20px;
}