kharbat Posted June 13, 2006 Share Posted June 13, 2006 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?? Quote Link to comment https://forums.phpfreaks.com/topic/11897-for-html-experts/ Share on other sites More sharing options...
bobleny Posted June 13, 2006 Share Posted June 13, 2006 <table width=[number of pixels]><tr><td width=[number of pixels]></td></tr></table> Quote Link to comment https://forums.phpfreaks.com/topic/11897-for-html-experts/#findComment-45132 Share on other sites More sharing options...
kharbat Posted June 13, 2006 Author Share Posted June 13, 2006 i used this before and it didn't work Quote Link to comment https://forums.phpfreaks.com/topic/11897-for-html-experts/#findComment-45136 Share on other sites More sharing options...
nogray Posted June 13, 2006 Share Posted June 13, 2006 try to use style sheet[code]<table style="width:100px;"><tr><td>text</td></tr><table>[/code]You'll need the px in the style sheet. Quote Link to comment https://forums.phpfreaks.com/topic/11897-for-html-experts/#findComment-45149 Share on other sites More sharing options...
kharbat Posted June 13, 2006 Author Share Posted June 13, 2006 i just tried style sheet.. table keeps resizing width.. any other suggestions? Quote Link to comment https://forums.phpfreaks.com/topic/11897-for-html-experts/#findComment-45238 Share on other sites More sharing options...
AndyB Posted June 13, 2006 Share Posted June 13, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/11897-for-html-experts/#findComment-45242 Share on other sites More sharing options...
kharbat Posted June 13, 2006 Author Share Posted June 13, 2006 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> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> </tr></table>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/11897-for-html-experts/#findComment-45249 Share on other sites More sharing options...
AndyB Posted June 13, 2006 Share Posted June 13, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/11897-for-html-experts/#findComment-45274 Share on other sites More sharing options...
kharbat Posted June 13, 2006 Author Share Posted June 13, 2006 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).torrentand i guess that there is no way to deal with this problem..Thanks alot for your time anyway.. and i really appreciate your help Quote Link to comment https://forums.phpfreaks.com/topic/11897-for-html-experts/#findComment-45277 Share on other sites More sharing options...
AndyB Posted June 13, 2006 Share Posted June 13, 2006 [!--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). Quote Link to comment https://forums.phpfreaks.com/topic/11897-for-html-experts/#findComment-45280 Share on other sites More sharing options...
bobleny Posted June 14, 2006 Share Posted June 14, 2006 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... Quote Link to comment https://forums.phpfreaks.com/topic/11897-for-html-experts/#findComment-45381 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.