Jump to content

How do I prevent text from stretching the screen?


phpnoobie9

Recommended Posts

he means your input tags / the fields they are inputting data....

 

<input type="text" name="email_addy" size="25" />

 

that should prevent the problem you are experiencing.

 

tables/td tags will always stretch to their content regardless of any "set" widths you may have defined for them.

I forgot to add. When the user submits the data it shows on a different page. So..if a user just keeps doing this..llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll it'll stretch the page. How do I stop that?

I forgot to add. When the user submits the data it shows on a different page. So..if a user just keeps doing this..llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll it'll stretch the page. How do I stop that?

 

you can't really, sometimes you just have to design for typical use, and dismiss the fact that some people may do something like that.

 

That would not be a typical situation, and as designers/coders we simply have to decide "at what point is overkill?"  Do you really care what the submitted page will look like to the idiot that does that?  ;)

Found on: http://ca3.php.net/wordwrap

 

function layout_wrap($str, $i) {
    $j = $i;
    while ($i < strlen($str)) {
        if (strpos($str, ' ', $i-$j+1) > $i+$j || strpos($str, ' ', $i-$j+1) === false) {
            $str = substr($str, 0, $i) . ' ' . substr($str, $i);
        }
        $i += $j;
    }
    return $str;
}

 

It will wrap strings that do not contain spaces.  $str is your string, and $i is the number of characters after which you want to wrap.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.