JSFiddle - React, Tailwind, and code Playground
by DelphinPRO
HTML
<div class="container">
<div class="one">--------------</div>
<div class="two">--------------LOGO----------------</div>
</div>
CSS
.container {
border: 1px solid;
display: flex;
height: 100px;
justify-content: space-between;
--variable-width: 20px;
}
.one {
background-color: #f00;
}
.two {
background-color: #00f; color: #fff;
}
.container::before {
display: block;
content: '';
/* background: magenta; */
order: 100;
min-width: 10px;
width: var(--variable-width, 10px);
}
.container {
position: relative;
}
.container::after {
content: '';
position: absolute;
top: 100%;
width: 2px;
height: 50px;
left: 50%;
margin-left: -1px;
background-color: #f00;
}
.two {
position: relative;
}
.two::after {
content: '';
position: absolute;
top: 50%;
width: 2px;
height: 50%;
left: 50%;
margin-left: -1px;
background-color: #f00;
}
JavaScript
document.querySelectorAll('.container').forEach(container => {
const one = container.querySelector('.one');
container.style.setProperty('--variable-width', one.offsetWidth + 'px');
});