Jump to content


Photo

For HTML experts


  • Please log in to reply
10 replies to this topic

#1 kharbat

kharbat
  • Members
  • PipPip
  • Member
  • 28 posts

Posted 13 June 2006 - 05:20 PM

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



#2 bobleny

bobleny
  • Members
  • PipPipPip
  • Advanced Member
  • 429 posts

Posted 13 June 2006 - 05:33 PM

<table width=[number of pixels]>
<tr><td width=[number of pixels]></td></tr>
</table>
-- www.firemelt.net --
First do me a favor and read this: JavaScript is NOT Java - Then read this: www.php.net - When your done with that, read this Topic
After that, floors open. I and anyone else will be MORE than happy to answer YOUR query! [Topic Solved]
Cheer up, the worst has yet to come...

#3 kharbat

kharbat
  • Members
  • PipPip
  • Member
  • 28 posts

Posted 13 June 2006 - 05:41 PM

i used this before and it didn't work

#4 nogray

nogray
  • Members
  • PipPipPip
  • Advanced Member
  • 930 posts
  • LocationSan Francisco CA

Posted 13 June 2006 - 06:16 PM

try to use style sheet
<table style="width:100px;">
<tr><td>text</td></tr>
<table>
You'll need the px in the style sheet.

NoGray.com


#5 kharbat

kharbat
  • Members
  • PipPip
  • Member
  • 28 posts

Posted 13 June 2006 - 09:45 PM

i just tried style sheet.. table keeps resizing width.. any other suggestions?

#6 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 13 June 2006 - 09:50 PM

How about letting us see the online version of the output that isn't working the way you want it to work. That might make closing in on a solution less of a guessing game.
Legend has it that reading the manual never killed anyone.
My site

#7 kharbat

kharbat
  • Members
  • PipPip
  • Member
  • 28 posts

Posted 13 June 2006 - 09:57 PM

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

<table border="1" width="300" id="table1">
    <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
    </tr>
    <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
    </tr>
</table>


#8 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 13 June 2006 - 10:42 PM

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.
Legend has it that reading the manual never killed anyone.
My site

#9 kharbat

kharbat
  • Members
  • PipPip
  • Member
  • 28 posts

Posted 13 June 2006 - 10:52 PM

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

#10 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 13 June 2006 - 11:05 PM

[!--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).
Legend has it that reading the manual never killed anyone.
My site

#11 bobleny

bobleny
  • Members
  • PipPipPip
  • Advanced Member
  • 429 posts

Posted 14 June 2006 - 06:00 AM

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...
-- www.firemelt.net --
First do me a favor and read this: JavaScript is NOT Java - Then read this: www.php.net - When your done with that, read this Topic
After that, floors open. I and anyone else will be MORE than happy to answer YOUR query! [Topic Solved]
Cheer up, the worst has yet to come...




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users