Log in

View Full Version : How do I force word wrap for long words?


richy96
02-21-2014, 12:37 PM
Hi folks

No doubt this has been asked and answered but I probably am not uing the correct search terms

How do I best prevent users from entering long string of characters like this?


************************************************** ***************

Or at least limit the length they can enter?

Or force a line break when the forum posts are displayed?


Problem I am having is with threads that have long lines of characters, displaying too wide on my mobile version of my site.

See images below, first one is displaying OK, second one is not due to long line of ******* forcing some of the text off the viewport on mobile devices, and also shifting the nav buttons and other screen elements to the right

Cheers
Rich
PS getting image attachments to dynamically resize to mobile screenwidth was a bit of a b^tch but I sorted that one ;)

Seven Skins
02-21-2014, 12:56 PM
Try using this in the css.

word-wrap: break-word

richy96
02-21-2014, 01:56 PM
Thanks

I tried that, I set the css property in 'body' and according to firebug my <td> is inheriting the property....... (see attached)

But it did not work, did I do something wrong? I'm only a self-taught (usually the hard way!) amateur

Rich

richy96
02-21-2014, 02:54 PM
I also found this property in the ACP (which was already set to 50) and set it to 36... but it did not help either

Number of Characters Before Wrapping Text
If you want posts to automatically insert spaces into long words to make them wrap after a certain number of characters, set the number of characters in the box above.

What's wrong???????????

Seven Skins
02-21-2014, 04:53 PM
You can try these:

word-break: break-all !important;
word-wrap: break-word !important;

Also set this to a lower number like 24 ... "Number of Characters Before Wrapping Text"

.

Simon Lloyd
02-21-2014, 05:40 PM
Maybe using something like preg_match_all("/(.)\1{2,}/",$p,$x) in a plugin using the hook newpost_process, that will prevent a character from being entered consecutively 3 times.

K4GAP
02-21-2014, 05:58 PM
I also found this property in the ACP (which was already set to 50) and set it to 36... but it did not help either

Number of Characters Before Wrapping Text
If you want posts to automatically insert spaces into long words to make them wrap after a certain number of characters, set the number of characters in the box above.


What's wrong???????????

The code cage? You have an error showing when I visited your site.

richy96
02-21-2014, 06:09 PM
The code cage??? What's that?

What error asre you seeing? my sites running ok just checked, 43 currently online, 67 registered today (no doubt get more this evening) and 502 visited today...... just a typical day on swapscene really :cool:

Simon Lloyd
02-21-2014, 07:40 PM
The code cage? You have an error showing when I visited your site.Yep, there's a deprecated error showing as im going through the files and making them compatible with the latest php - thanks for the heads up though :)