Jump to content

table trouble

  • Please log in to reply
2 replies to this topic

#1 Guest_edwinsweep_*

  • Guests

Posted 20 July 2006 - 12:21 PM

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
<style type="text/css">
body {
background: white;
include ('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>';
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!

#2 Ninjakreborn

  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 20 July 2006 - 01:16 PM

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.


Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.

#3 manichean

  • Members
  • PipPip
  • Member
  • 29 posts

Posted 20 July 2006 - 02:18 PM

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.

<style type="text/css">
body {
background: white;
	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 />
	echo "<td width=\"76%\">middle</td>\n";
	echo "<td width=\"12%\">3</td>\n";
	echo "</tr>\n";
	echo "</table>\n";

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 dislike

Hope this helps ya
Ciao for now

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users