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.

Link to comment
Share on other sites

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?  ;)

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.