Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is word-wrap not working?

Tags:

html

css

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

like image 865
peace_love Avatar asked Nov 03 '15 11:11

peace_love


People also ask

Why is wrap text not working in word?

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.

How do I force word wrap?

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.

Why can I not wrap text around a picture in word?

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.


1 Answers

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!

like image 139
Arindam Dawn Avatar answered Oct 12 '22 13:10

Arindam Dawn