I am trying to add guitar chords above text, just like in this question. While that technique works in most cases, I would like to extend it to also work in the following situation, where the chords overlap:
p {
margin-top:50px;
}
span.chunk {
position:relative;
}
span.chunk:before {
content:attr(data-chord);
position:absolute;
top:-15px;
}
<p>
As
<span class="chunk" data-chord="C">I was going over the</span>
<span class="chunk" data-chord="Am">f</span>
<span class="chunk" data-chord="B">ar</span>
</p>
The end result should simply push the whole chunk over, like this:
Is there a way I can accomplish this, preferably using just CSS?