Guest edwinsweep Posted July 20, 2006 Share Posted July 20, 2006 hi everybody, i just created a new page with a table layout.it has 2 rows.1 at top with width of 100%, this is the header!and another row under that. containing 2 table cells.1 for the menu and 1 for the content.but when the content cell becomes longer than the page can handle, you get a scrollbar!this is normal, but when this scrollbar comes, the top table row changes size.its only 1 or 2 pixels, but very anoying when it has to fit a picture!here is the code[CODE]<style type="text/css">body {background: white;margin:0px;right:0px;}</style><phpinclude ('dbcon.inc.php');$mainpage = 'forum/index.php';//$mainpage = "testpg.php";echo '<table border=1 width=100% height=100% cellspacing=0 cellpadding=0><tr height=100><td colspan=3>top</td></tr>';echo '<tr height=85%><td width=12% rowspan=10>1</td><td width=76%>'; include($mainpage); echo'</td><td width=12%>3</td></tr>';//echo '<tr><td colspan=2>hoi</td></tr>';echo '</table>';?>[/CODE]does anybody know why this is happening?i tryed to change it with css, so that the scrollbar will always be visible.but even then it changes the size of the top row!thanks in advance! Quote Link to comment https://forums.phpfreaks.com/topic/15134-table-trouble/ Share on other sites More sharing options...
Ninjakreborn Posted July 20, 2006 Share Posted July 20, 2006 with my experience this happens a lot with percentages, try fixed width's on this see if it helps if not I have no idea. Quote Link to comment https://forums.phpfreaks.com/topic/15134-table-trouble/#findComment-60975 Share on other sites More sharing options...
manichean Posted July 20, 2006 Share Posted July 20, 2006 Its a bit hard to post a reply to this sort of question when there is more info needed. What resolution are you planning on running this layout on ?Does the background of the header have a constant color to match the image you are placing there ?Percentages as widths will always change the size of the header across different resolutions. There two options you have, either you can choose a fixed width of lets say 775px catering for the smallest resolution of 800x600 therefor the header will never change size. or you can make the table 90% wide and use a style to align it in the middle in which case the image you place in the header would have to be centered and the backgroung color of the row matching the background color of the image. I presume the second one is what you are insterested in so here is the code i have come up with. [code]<html><head><style type="text/css">body {background: white;margin:0px;right:0px;}</style></head><body><?php echo "<table border=\"1\" width=\"90%\" height=\"100%\" cellspacing=\"0\" cellpadding=\"0\" style=\"margin:0 auto 0 auto\">\n"; echo "<tr height=\"100\">\n"; echo "<td colspan=\"3\">top</td>\n"; echo "</tr>\n"; echo "<tr height=\"85%\">\n"; echo "<td width=\"12%\" rowspan=\"10\"> <br /> <br /> <br /> <br /> </td>\n"; echo "<td width=\"76%\">middle</td>\n"; echo "<td width=\"12%\">3</td>\n"; echo "</tr>\n"; echo "</table>\n";?></body></html>[/code]Another option is to have javascript write the page for you given the users resolution and depending on the resolution make use of different size images for the header, that way you would be able to set the size without using percentages preventing the pixel change you dislikeHope this helps ya Ciao for now Quote Link to comment https://forums.phpfreaks.com/topic/15134-table-trouble/#findComment-61019 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.