View Full Version : Word Wrap
Say someone puts something like, "wusaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaah" in a string and posts it in something i want to only be 150px wide. For Example: http://chronicyouth.com/ Is there something that will split the word after so many charactors and insurt a <br>? like PHP's wordwrap()
Roelf
11-26-2002, 06:51 AM
what you mention is not easy to accomplish, you want the text to be 150 px so you want to isert a break after a certain amount of characters. but what if the user has a different browser setting for the font size (fe the visually handicapped people will probably have those settings altered)the the amount of characters you fix will not have the same width. And what about a string with a lot of i's in it, or with a lot of m's and w's. you will have to use a non-proportional font the whole time. I once created a wordwraproutine, for use in an svgfile, it would create a text element, with for each stringpart in it a few tspanelements. i will do a search on my pc. when i find it i will post it. but the results where not nice because of the problems mentioned above. what it did have, was an extra argument you could pass to center (or not to center) the entire tekstblock
glenngv
11-26-2002, 07:28 AM
you can put the text in a div and set overflow-x to auto, so that a horizontal scrollbar will display if the content's length overflows the width of the div
<td>
<div style="width:150px;height:35px;overflow-x:auto;">
wusaaaaaaaaaaaaaaaawussdfsadfsdfsdfsdfsdfsdfsfsdfd</div>
</td>
Thought of that. Not sure it's what I am looking for though. Not very smooth.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.