My word-wrap is not working at all
<table border="1" style="width:100%">
<thead>
<tr>
<th>very long word</th>
</tr>
</thead>
<tbody>
<tr>
<td style="word-wrap:break-word;">ablkasd/123123123/agsdfasdf/asdfasdfasdf/_sdfsdfsdf{123123-14werwwer-14124124-wefweshtsdf-235232323}/3235235/dasasdfasdfasdf.bsfs</td>
</tr>
</tbody>
</table>
The string is not breaking and is always in one line.
I already tried all solutions from Word Wrap not working properly but still not working
Enable or disable text wrapping for a text box, rich text box, or expression box. Right-click the control for which you want to enable or disable text wrapping, and then click Control Properties on the shortcut menu. Click the Display tab. Select or clear the Wrap text check box.
You can force long (unbroken) text to wrap in a new line by specifying break-word with the word-wrap property. For example, you can use it to prevent text extending out the box and breaking the layout. This commonly happens when you have a long URL in the sidebar or comment list.
The reason that this won't work is because wrapping of text, in Word, is implemented through the interaction of two layers of content: the text layer and the drawing layer. When an object is on the drawing layer, information on the text layer can be wrapped around it.
Although the answer has been accepted, I would like to add to the accepted answer that apart from
table td {word-wrap:break-word;}
you need to ensure that the white-space property is not set to nowrap or pre.
This can prevent your td content word-wrapping even if you apply word-wrap: break-word
If some other css styles is setting you td white-space property, you can add
table td {
word-wrap:break-word;
white-space: normal;
}
This will ensure your td content has proper word-wrapping.
Hope it helps someone!
If 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