Possible Duplicate:
CSS: How do I wrap text with no whitespace inside a <td>?
I have a line of text that is hundreds of characters long, and that I need to display on a page.
Because the line is continuous with no spaces, the browser won't wrap the text. My goal is to have the text wrap according to the size of the browser window.
Anyone know how to do this using CSS?
Example code:
<html>
<body>
<table> <tr><td>
mffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff</td> </tr></table>
</body>
</html>
You can wrap a long string, which does not have any whitespace character by using the CSS word-wrap property, or overflow-wrap, if you use CSS3. In this snippet, you'll find some examples for block elements, as well as for the inline ones.
To insert a text wrapping break, put your cursor where you want the text to break, and go to Layout | Page Setup | Breaks, and select Text Wrapping. Now the text has dropped below the picture without using any superfluous paragraph breaks.
To prevent the text from wrapping, you can use the CSS white-space property with the “nowrap” or “pre” value.
You can use the CSS properties overflow-wrap and word-break to manage content overflow. However, there are differences in the way the two properties handle it. Using overflow-wrap will wrap the entire overflowing word to its line if it can fit in a single line without overflowing its container.
With this css
word-break: break-all;
you get what you want.
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