Here is the markup I am working with:
<div class="container">
<div class="left-rect"></div>
<div class="text">Lorem ispum</div>
<div class="right-rect"></div>
</div>
.left-rect,
.right-rect {
background-color: #EEE;
width: 9px;
}
.container {
background-color: #555;
height: 20px;
}
I want it to have this appearance:
It is essential that the width of the .rect elements adjusts based on the width of the .text element, which automatically adapts to fit its content.
Therefore, if a longer text is added to .text, the .rect should widen accordingly while the left and right rects remain at the edges. The .rect div can be dynamically positioned using JavaScript.
I am completely lost on how to achieve this.
I hope my explanation makes sense.