Jump to content

overflowing table


OLM3CA

Recommended Posts

hi!
First of all i would like to say that my english is not good enough so sorry about this.
My question is : i am getting datas from Mysql,i put them in a table(not sql table,html).
But i saw that the width of my table become wider (overflow horizantally).
I realised that when i don't use spaces while sending the text,this happens.
I want to add ; i made table widths to a fixed number (700) , İ used to solve this problem by nl2br() function but can't solve.
Now can you help me to solve this question ? i am so confused... Thank You
Link to comment
Share on other sites

[color=red]<table border='1' bordercolor='#E8E8E8' width='700' cellpadding='2' cellspacing='0' class='tablo'>[/color]
        <tr>
<td colspan='3' bgcolor='#E8E8E8' width='700'></td>
</tr>
<tr bgcolor='#F4F4F4'>
        <td width='70' align='right' bgcolor='#F4F4F4'><strong>Kay&#305t No </strong></td>
        <td width='10' align='right' bgcolor='#F4F4F4'>:</td>
        <td width='620' align='left'>.$row['no'].</td>
        </tr>
        <tr bgcolor='#F4F4F4'>
        <td width='70' align='right' bgcolor='#F4F4F4'><strong>G&oumlnderen</strong></td>
        <td width='10' align='right' bgcolor='#F4F4F4'>:</td>
        <td width='620' align='left'>.$row['isim'].</td>
        </tr>
        <tr bgcolor='#F4F4F4'>
        <td width='70' align='right' bgcolor='#F4F4F4'><strong>Yer</strong></td>
        <td width='10' align='right' bgcolor='#F4F4F4'>:</td>
        <td width='620' align='left'>.$row['sehir'].</td>
        </tr>
        <tr bgcolor='#F4F4F4'>
        <td width='70' align='right' bgcolor='#F4F4F4'><strong>Tarih</strong></td>
        <td width='10' align='right' bgcolor='#F4F4F4'>:</td>
        <td width='620' align='left'>.$row['tarih'].</td>
        </tr>
        <tr bgcolor='#F4F4F4'>
        <td width='70' align='right' bgcolor='#F4F4F4'><strong>Ba&#351l&#305k</strong></td>
        <td width='10' align='right' bgcolor='#F4F4F4'>:</td>
        <td width='620' >.$row['baslik'].</td>
        </tr>
        <tr bgcolor='#F4F4F4'>
        <td width='70' align='right' valign='top' bgcolor='#F4F4F4'><strong>Yorum</strong></td>
        <td width='10' align='right' valign='top' bgcolor='#F4F4F4'>:</td>
        <td width='620'>.$row['msg']</td>
        </tr>
    [color=red]  </table>[/color]
Link to comment
Share on other sites

If you're not using spaces then the browser will try and squeeze as much in as possible and it will force the table to be wider than what you have set. The only way to stop this from happening is to include spaces - I presume your output is of words?

For example, if your table was 700 wide and you display a picture 800 wide inside a cell the browser wouldn't shrink the image but would instead make the table wider to accomodate the image.
Link to comment
Share on other sites

aham ok works like this :

There is a form for users to post messages name location title and message.when the user post these we send them to database.the text = the message the user sends. I would like to add spaces to this message
Link to comment
Share on other sites

Surely the users are entering spaces between each word themselves? That should be enough.

When you get the message from the database and display it in a cell in the table as long as you've set a width when you define the table it should stay that width as long as there are no single words longer than the width.
Link to comment
Share on other sites

okey but the problem is that if a person writes a message with using none space ? what would happen overflows again. I have to solve it becouse i am designing a site with no approval I mean ı dont control.
the messages directly shown in homepage or etc...
Link to comment
Share on other sites

As far as I'm aware there's no way around this without writing a complex routine to split the message into an array holding each word, find the longest word in the array and if a word is longer than a certain length then don't accept the message.

The big problem would be that nearly all fonts have characters of different widths so this wouldn't be reliable - for example a "W" is a lot wider than an "i"

If your table is 700 wide then I can't really see a word being long enough to ruin it unless someone was being silly when entering their message.

Just thought - you could use an iframe perhaps?
http://www.htmlcodetutorial.com/frames/_IFRAME.html
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.