Let's talk about the scenario:
https://i.stack.imgur.com/we05U.png
In the image, there is a container (displayed as a div) with only one child - a span element. The goal is to introduce a second child that occupies the entire red space depicted in the picture.
If the span were to fit on just one line, this could have been easily achieved using flexbox. However, given the line break seen in the image, applying flex properties to the container causes all lines to reposition themselves sideways to accommodate the new child, which is not the desired outcome.
If handling this layout purely through CSS proves impossible, is there a way to determine the width of the last line of text? One potential solution might involve calculating the width using JavaScript; I simply need a means to identify how much space has already been utilized within that line.
Update: The intended second element will be an input. This requirement rules out utilizing 'text-align: justify' for alignment purposes.
Below is the provided code snippet:
div {border: 1px dotted black; width: 400px}
<div>
<span>lorem ipsum, quia dolor sit, amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt, ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis</span>
<input >
</div>