I want to display a short text-align-centered sentence like this.
<p style="font-size: 13px; text-align: center; width: 600px;">
This is a variable-length sentence which is sometimes only a few words and sometimes up to three lines long.
</p>
This is a variable-length sentence which is sometimes only a few words and sometimes up to three lines long.
What happens now is that, because of the width, the last two words "lines long" fall on the next line of the paragraph. In a centered alignment this looks rather ugly. My current method of solving this is to manually insert a break in the right place.
<p style="font-size: 13px; text-align: center; width: 600px;">
This is a variable-length sentence which is sometimes<br/>only a few words and sometimes up to three lines long.
</p>
This is a variable-length sentence which is sometimes
only a few words and sometimes up to three lines long.
This becomes tiring to do all the time. Is there a way in HTML do this automatically? So basically to first let a "p" element determine the minimum number of lines it needs to show the text, and then to shrink it horizontally as much as possible, while keeping the same number of lines?