aaarrrggh Posted April 4, 2006 Share Posted April 4, 2006 Hi,I'm currently trying to display some php output inside a html table. All the data is printing just as I want, except that the table itself seems to resize and reshape according to what data comes out of php. Is there any way for me to force the table and all table cells to stay exactly the same size no matter what?You can see the table I'm talking about by viewing this temporary site: [a href=\"http://www.itr.org.uk/home.php?page_id=tables.php&showtable=33\" target=\"_blank\"]http://www.itr.org.uk/home.php?page_id=tab...hp&showtable=33[/a]As you can see right now, it doesn't look neat at all. Does anybody know how I can fix this? Quote Link to comment https://forums.phpfreaks.com/topic/6584-help-restraining-html-table-sizes/ Share on other sites More sharing options...
redbullmarky Posted April 4, 2006 Share Posted April 4, 2006 this is a HTML question so nothing to do with your PHP, but in a nutshell, you're drawing a different table for each footy team. if you drew one table and just used PHP to cycle through and draw the <tr>'s instead of the full <tables>, then you'll have a much better looking table:[code]<table> <tr> <td></td> <td></td> </tr> <tr> <td></td> <td></td> </tr></table>[/code]instead of what you have right now:[code]<table> <tr> <td></td> <td></td> </tr></table><table> <tr> <td></td> <td></td> </tr></table>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/6584-help-restraining-html-table-sizes/#findComment-23889 Share on other sites More sharing options...
gijew Posted April 4, 2006 Share Posted April 4, 2006 Might want to think about throwing some <TD width="x"> in there as well for resizing. Quote Link to comment https://forums.phpfreaks.com/topic/6584-help-restraining-html-table-sizes/#findComment-23892 Share on other sites More sharing options...
aaarrrggh Posted April 4, 2006 Author Share Posted April 4, 2006 Thanks guys. I did what redbull said, and it seems to be looking a lot better now.Just out of interest, would using <TD width="x"> restrict the size of the table even when data comes through php that is too big for the table cell? Is there anyway to stop it from resizing?This isn't a problem to me right now, but it's something I know I might need to know in the future. Thanks for the help once again :) Quote Link to comment https://forums.phpfreaks.com/topic/6584-help-restraining-html-table-sizes/#findComment-23903 Share on other sites More sharing options...
redbullmarky Posted April 4, 2006 Share Posted April 4, 2006 [!--quoteo(post=361654:date=Apr 4 2006, 07:47 PM:name=aaarrrggh)--][div class=\'quotetop\']QUOTE(aaarrrggh @ Apr 4 2006, 07:47 PM) [snapback]361654[/snapback][/div][div class=\'quotemain\'][!--quotec--]Just out of interest, would using <TD width="x"> restrict the size of the table even when data comes through php that is too big for the table cell? Is there anyway to stop it from resizing?[/quote]to an extent. holding a table column to a width would normally cause the info in the cells to continue on a new line, but depends.if i was setting up a league table personally, i would change your code by removing the 'width' property from your football team name column but leaving the rest alone. you've set the width of the table to 420 or something and yet all your column widths don't add up to much more than 200. removing the width property from the largest column (ie, the team name) will at least prevent other problems in the future. Quote Link to comment https://forums.phpfreaks.com/topic/6584-help-restraining-html-table-sizes/#findComment-23918 Share on other sites More sharing options...
aaarrrggh Posted April 4, 2006 Author Share Posted April 4, 2006 [!--quoteo(post=361669:date=Apr 4 2006, 02:15 PM:name=redbullmarky)--][div class=\'quotetop\']QUOTE(redbullmarky @ Apr 4 2006, 02:15 PM) [snapback]361669[/snapback][/div][div class=\'quotemain\'][!--quotec--]to an extent. holding a table column to a width would normally cause the info in the cells to continue on a new line, but depends.if i was setting up a league table personally, i would change your code by removing the 'width' property from your football team name column but leaving the rest alone. you've set the width of the table to 420 or something and yet all your column widths don't add up to much more than 200. removing the width property from the largest column (ie, the team name) will at least prevent other problems in the future.[/quote]I tried removing the width property from the team column, and it's worked perfectly. Is that because this now becomes the most 'flexible' column, if you know what I mean? Like... any available empty space is allocated to this column first because there's no explicit 'width' property defined? Is that why this works? Thanks for the help by the way, the tables are looking a lot better now :) Quote Link to comment https://forums.phpfreaks.com/topic/6584-help-restraining-html-table-sizes/#findComment-23930 Share on other sites More sharing options...
redbullmarky Posted April 4, 2006 Share Posted April 4, 2006 [!--quoteo(post=361682:date=Apr 4 2006, 08:42 PM:name=aaarrrggh)--][div class=\'quotetop\']QUOTE(aaarrrggh @ Apr 4 2006, 08:42 PM) [snapback]361682[/snapback][/div][div class=\'quotemain\'][!--quotec--]...Is that because this now becomes the most 'flexible' column, if you know what I mean? Like... any available empty space is allocated to this column first because there's no explicit 'width' property defined?...[/quote]basically, you got it in one. yep :) Quote Link to comment https://forums.phpfreaks.com/topic/6584-help-restraining-html-table-sizes/#findComment-23953 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.