Jump to content

Recommended Posts

Hi there,

I am using javascript that writes an output text into a table. The tables consists of several rows and several columns.

The output text length is not fixed.. each time could have a different length.

the table keeps resizing cells width according to the length of the text, so the table's view becomes in consistent. is there anyway to have a table with a fixed size or width for cells?

makes sense??

Link to comment
https://forums.phpfreaks.com/topic/11897-for-html-experts/
Share on other sites

lol.. sure.. i will put a code below.. Try editing it with frontpage or some editior..

try to type something that exceeds cells width.. the table will resize width of the cells, so they become inconsistent.. all what i want is to know if there is a way to let cells width remain fixed when some long text entered the text get orgnized in lines rather than resizing cells..

any help is really appreciated

[code]
<table border="1" width="300" id="table1">
    <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
    </tr>
    <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
    </tr>
</table>
[/code]
Link to comment
https://forums.phpfreaks.com/topic/11897-for-html-experts/#findComment-45249
Share on other sites

As long as there are breaks (spaces) in the text, it will wrap around and not extend the width of the table cells beyond what you have specified.

On the other hand if you have text like thisisaverylongandboringsillystatementdesigned to breaktablesbecauseIthinkIcanhavefunwithstufflikethis ... then the table will expand as it has no clue where (or why) to break the text.

At least that's how my browser works.
Link to comment
https://forums.phpfreaks.com/topic/11897-for-html-experts/#findComment-45274
Share on other sites

yeah i think that too.. in fact the output text is a file name that might be long and continuous sometimes like this

WindowsVistaBeta2ISOBuild5384432bitx86(www.fulldls.com).torrent

and i guess that there is no way to deal with this problem..

Thanks alot for your time anyway.. and i really appreciate your help
Link to comment
https://forums.phpfreaks.com/topic/11897-for-html-experts/#findComment-45277
Share on other sites

[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]i guess that there is no way to deal with this problem..[/quote]
Not with plain html. But if you're using javascript there ought to be string handling functions that let you break long strings into shorter strings. One obvious problem is that some visitor may decide to change the font size and all your pixel-precision goes out the window then.

Perhaps you need to rethink the format of your presentation to cope with the overly long filenames (or words).
Link to comment
https://forums.phpfreaks.com/topic/11897-for-html-experts/#findComment-45280
Share on other sites

I couldnt do this but I know that there is a way to do it but what if you where to create a PHP script that will count the number of letters in the variebles and add a <br /> tag when a certain number of letters are present. And if it is manually inputed text it could do the same thing...

I know it could be done. Maybe some one here would want to do it...
Link to comment
https://forums.phpfreaks.com/topic/11897-for-html-experts/#findComment-45381
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.