I spent many hours on it. I tried to describe the problem in the attached image. You need to wrap the text with white lines with spaces between lines and texts.

The first solution I was thinking about was to simply put the text in a line using the smth line "margin-top: -20px;" and provide a custom background for the text container (e.g. gray). But this is not a solution, because the container background is transparent :(
I thought of doing something like this (using "float: left"):
<div class="line"></div> <div class="text">TEXT</div> <div class="line"></div> <div class="text">TEXT</div> <div class="line"></div>
but if I use float: left for all elements there is another problem: the white line should end on the right side of the container.
Perhaps there are some better recommendations for this problem, or someone can give some advice ..? Any ideas would be helpful :)!
source share