Imagine I have a long, multi-word line of text in a DIV:
Hello there, dear customer. Please have a look at our offer.
The DIV has a dynamic width. I want to word wrap the above text. Currently, the wrapping happens on a word boundary which maximizes the length of the first line:
|-DIV WIDTH------------------------------------| Hello there, dear customer. Please have a look at our offer.
I would prefer that the wrapping happen on the sentence boundary. However, if no wrapping is necessary, I would like the line to remain as one.
To illustrate my point, please look at the various DIV widths and how I would like my text to wrap:
|-DIV WIDTH--------------------------------------------------------| Hello there, dear customer. Please have a look at our offer. |-DIV WIDTH-----------------------------------| Hello there, dear customer. Please have a look at our offer. |-DIV WIDTH--------| Hello there, dear customer. Please have a look at our offer.
With words, you can use a soft hyphen so that the word wrapping happens on suggested syllable boundaries. If no wrapping is needed, the ­
remains invisible. If wrapping is needed, the ­
is where it happens:
magnifi­cently
Is there an analogous method for hinting word-wrapping in HTML?
Definition and Usage The wrap attribute specifies how the text in a text area is to be wrapped when submitted in a form.
HTML | <td> nowrap Attribute The HTML <td> nowrap Attribute is used to specify that the content present inside the cell should not wrap. It contains the Boolean value.
Use ­
in words or <wbr>
between words, as <wbr>
won't introduce a hyphen.
See also:
<wbr>
compat listIf you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With