Hello,
I have a comment system that i wrote in PHP when i have used linebreak: $area = wordwrap($area, 62,"<br>",1); to auto break after 67 charectars so my comments don't go over a css box but when i write in uppercase; since the letters are larger it overflows. How can i stop this? You can see the effect of this here.

Sanchixx

Member Avatar
LastMitch

@Sanchixx

This is issue is close to CSS than PHP. You can used a DIV container to word-wrap

div {
    width: 300px;
    word-wrap: break-word;
}

Based on the example you provided I think this might work:

$area = wordwrap($area, 62,"<br />\n",1);

It's a bit hard to figure out it without actually see the whole script.

put scroll on the box inside or detect uppercase : if (preg_match('/[A-Z]+/', $str))

I'v already done all those things, and for checking if it's uppercase what if only part of the text is uppercase!

split after a few characters in all the ways...
str_split($string, 30);

Member Avatar
diafol

This works for IE9, Chrome, Safari: word-break:break-all;
This works for IE9, Chrome, Safari, Opera, Safari: word-wrap:break-word;

However, which versions started implementing this, I don't know.

In the days of RWD, static break-points (e.g. splitting) are redundant.