I want to have buttons at the side of a paragraph, vertically aligned with elements in that paragraph:
<div style="width:20%">
This is an example text. This is an example text. This is an example text. This is
an example text. This is an <span>A</span> <button>Aligned with A</button> example text. This is an example text.
This is an example text. This <span>B</span> <button>Aligned with B</button> is an example text. This is an example
text. This is an example text. This is an example text. This <span>C</span><button>Aligned with C</button> is an
example text. This is an example text.
</div>
In this example, I want to have one button vertically aligned with each of the elements in the text. I cannot set the vertical position fixed because they number of rows in the text varies with actual width of the wrapper div, and I cannot use display: table because I don't want a line break in the text paragraph. The output should look like this:
Since the width of the wrapper div is determined by the browser, I don't know where the lines break and therefore don't know the vertical alignment of the text. Is there a way to align the buttons with specific elements in the div?
This is different from just vertically aligning two columns since the text paragraph breakpoints are independent of the button occurrences on the right.