almightyegg Posted August 7, 2007 Share Posted August 7, 2007 I have a table like: <table border="0" width="1000" cellpadding="6" cellspacing="5"> <tr> <td width="150" rowspan="2" valign="top"><td> <td width="650" bgcolor="#212121">Title goes up here!</td> <td width="200" bgcolor="#111111" rowspan="2" valign="top"></td> </tr> <tr> <td width="650" bgcolor="#000000" valign="top">Main page goes here!</td> </tr></table> The problem is that the title table cell is mean! If the main page cell isn't very full then the title cell enlarges! it takes up half the page. How do I control its height?? I know putting height="X" doesn't work Quote Link to comment https://forums.phpfreaks.com/topic/63647-table-cell-height/ Share on other sites More sharing options...
wildteen88 Posted August 7, 2007 Share Posted August 7, 2007 You havn't closed the cell on the following line, you're putting in two blank table cells. This is what is breaking your table. <td width="150" rowspan="2" valign="top"><td> It should be: <td width="150" rowspan="2" valign="top"></td> Quote Link to comment https://forums.phpfreaks.com/topic/63647-table-cell-height/#findComment-317232 Share on other sites More sharing options...
almightyegg Posted August 7, 2007 Author Share Posted August 7, 2007 Ihave, it's just that editted a lot of stuff out of the table to post it, I must have cut it out for posting by accident but it is there in my actual code Quote Link to comment https://forums.phpfreaks.com/topic/63647-table-cell-height/#findComment-317471 Share on other sites More sharing options...
almightyegg Posted August 7, 2007 Author Share Posted August 7, 2007 Here is an image showing the problem http://www.a3share.com/members/69189/example.jpg You can see that the top cell of the middle column has spread downwards. I have tried taking a different approach with it by changing the background to an image and then stating the height, but no joy <td width="650" background="/images/topbar.png" height="20" valign="top"><center>Title!</center></td> Quote Link to comment https://forums.phpfreaks.com/topic/63647-table-cell-height/#findComment-317571 Share on other sites More sharing options...
wildteen88 Posted August 7, 2007 Share Posted August 7, 2007 If you are working with tables. Turn table borders on so you can see the boundaries for the cells. Also it may help if we can get to see the actuall HTML source code fro that page. Its kinda hard to tell why it's doing that. Quote Link to comment https://forums.phpfreaks.com/topic/63647-table-cell-height/#findComment-317581 Share on other sites More sharing options...
almightyegg Posted August 7, 2007 Author Share Posted August 7, 2007 The whole page? <? include 'db.php'; // Connect to DB $email = $_COOKIE['email']; $password = $_COOKIE['password']; if((!$email) || (!$password)){ echo "Please enter ALL of the information! <br />"; include 'index.php'; exit(); } $sql = mysql_query("SELECT * FROM users WHERE email = '$email'"); $mem = mysql_fetch_array($sql); $link = mysql_query("SELECT * FROM links") or die(mysql_error()); $qlink = mysql_fetch_array($link); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <link rel="stylesheet" href="default.css"> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Iridia Central</title> </head> <body bgcolor=black> <center> <? include 'links.php'; ?> </center> <table border="1" width="1000" cellpadding="6" cellspacing="5"> <tr> <td width="150" rowspan="2" valign="top"><? include 'panel.php'; ?></td> <td width="650" background="/images/topbar.png" height="20" valign="top"><center>Iridia Central</center></td> <td width="200" bgcolor="#111111" rowspan="2" valign="top"><left><? include 'links2.php'; ?></left></td> </tr> <tr> <td width="650" bgcolor="#000000" valign="top"> <li><a href=http://www.lordoftheabyss.com/house.php?id=<? echo $mem[id] ?>><? echo $mem[username] ?>'s House</a> <li><a href=http://www.lordoftheabyss.com/society/index.php>Society Hall</a> <li><a href=http://www.lordoftheabyss.com/mysociety.php?id=<? echo "$mem[clutch]"; ?>>My Society</a> <li><a href=http://www.lordoftheabyss.com/market>Market Square</a> <li><a href=http://www.lordoftheabyss.com/quests/main>Old Man's Hut</a> <li><a href=http://www.lordoftheabyss.com/hall>Town Hall</a> <li><a href=http://www.lordoftheabyss.com/>link</a> <li><a href=http://www.lordoftheabyss.com/>link</a> <li><a href=http://www.lordoftheabyss.com/>link</a> <li><a href=http://www.lordoftheabyss.com/>link</a> <li><a href=http://www.lordoftheabyss.com/>link</a> <li><a href=http://www.lordoftheabyss.com/>link</a> </td></tr> </table> <center> <? include 'links.php'; ?> </center> </body> </html> http://www.a3share.com/members/69189/example.jpg that's the image with borders now Quote Link to comment https://forums.phpfreaks.com/topic/63647-table-cell-height/#findComment-317600 Share on other sites More sharing options...
wildteen88 Posted August 7, 2007 Share Posted August 7, 2007 Its better looking at the html source code the php script generates. Right click view source in your web browser. Quote Link to comment https://forums.phpfreaks.com/topic/63647-table-cell-height/#findComment-317736 Share on other sites More sharing options...
mdnghtblue Posted August 7, 2007 Share Posted August 7, 2007 You could try creating a class for that td cell and setting the height in CSS...that's what I'd do, anyway. =/ Quote Link to comment https://forums.phpfreaks.com/topic/63647-table-cell-height/#findComment-317771 Share on other sites More sharing options...
almightyegg Posted August 7, 2007 Author Share Posted August 7, 2007 Its better looking at the html source code the php script generates. Right click view source in your web browser. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <link rel="stylesheet" href="default.css"> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Iridia Central</title> </head> <body bgcolor=black> <center> <br><a href="http://www.lordoftheabyss.com/house.php">Lord of the Abyss's House</a> | <a href="http://www.lordoftheabyss.com/iridia.php" border="0">Iridia Central</a> | <a href="http://www.lordoftheabyss.com/society/mysociety.php?id=10">My Society</a> | <a href="http://www.lordoftheabyss.com/market/index.php?sort=lowcost" border="0">Market Square</a> | <a href="http://www.lordoftheabyss.com/battle/index.php" border="0">Battle</a> | <a href="http://www.lordoftheabyss.com/quests/main/index.php" border="0">Old Man's Hut</a> | <a href="http://www.lordoftheabyss.com/im/index.php">Instant Message</a> | <a href="http://www.lordoftheabyss.com/forum/" border="0">Message Board</a> | <a href="http://www.lordoftheabyss.com/player/find.php" border="0">Find Player</a> | <a href="http://www.lordoftheabyss.com/account/index.php" border="0">Account Settings</a> | <a href="http://www.lordoftheabyss.com/logout.php" border="0">Logout</a><br><br></center> <table border="1" width="1000" cellpadding="6" cellspacing="5"> <tr> <td width="150" rowspan="2" valign="top"><table border=0 cellpadding=5><tr><td> <center><img src=http://www.lordoftheabyss.com/images/icons/male.JPG title=Male> <img src=http://www.lordoftheabyss.com/images/icons/admin.png title=Administrator> <img src=http://www.lordoftheabyss.com/images/icons/mod.png title=Moderator> <img src=http://www.lordoftheabyss.com/images/icons/demon.png title=Demon><br><img src='http://www.lordoftheabyss.com/images/players/default2.jpg'> <center> <b>LF:</b> 15 / 15<br> <div style="background-color:red;height:8px;width:120px;"> <div style="background-color:green;float:left;height:8px;width:100%;"></div></div><br><br> <b>Exp:</b> 0 / 150<br> <div style="background-color:red;height:8px;width:120px;"> <div style="background-color:green;float:left;height:8px;width:0%;"></div></div> </center> </center></td></tr><tr><td bgcolor=#222222><fieldset><legend><b>Game Time</b></legend> <b>Current Time:</b> <br> 07-08-2007 11:08:35<br> <br></fieldset> <br><fieldset><legend><b>Stats</b></legend> <b>Level:</b> 500<bR> <b>Gold:</b> 9,950,000<br> <b>Treasures:</b> <br> <b>APs:</b> 0<bR> <b>Strength:</b> 3.00<br> <b>Speed:</b> <bR> <b>Stamina:</b> 2.00<br> <b>Magic:</b> 1.00<bR> <b>Stats:</b> 6<br> <br></fieldset><br><bR></td></tr> </table></td> <td width="650" background="/images/topbar.png" height="20" valign="top"><center>Iridia Central</center></td> <td width="200" bgcolor="#111111" rowspan="2" valign="top"><left><br><a href="http://www.lordoftheabyss.com/house.php">Lord of the Abyss's House</a><br> <a href="http://www.lordoftheabyss.com/iridia.php" border="0">Iridia Central</a><br> <a href="http://www.lordoftheabyss.com/society/mysociety.php?id=10">My Society</a><br> <a href="http://www.lordoftheabyss.com/market/index.php?sort=lowcost">Market Square</a><br> <a href="http://www.lordoftheabyss.com/battle/index.php" border="0">Battle</a><br> <a href="http://www.lordoftheabyss.com/quests/main/index.php" border="0">Old Man's Hut</a><br> <a href="http://www.lordoftheabyss.com/im/index.php">Instant Message</a><br> <a href="http://www.lordoftheabyss.com/forum/" border="0">Message Board</a><br> <a href="http://www.lordoftheabyss.com/player/find.php" border="0">Find Player</a><br> <a href="http://www.lordoftheabyss.com/account/index.php" border="0">Account Settings</a><br> <a href="http://www.lordoftheabyss.com/logout.php" border="0">Logout</a><br><br></left></td> </tr> <tr> <td width="650" bgcolor="#000000" valign="top"> <li><a href=http://www.lordoftheabyss.com/house.php?id=1>Lord of the Abyss's House</a> <li><a href=http://www.lordoftheabyss.com/society/index.php>Society Hall</a> <li><a href=http://www.lordoftheabyss.com/mysociety.php?id=10>My Society</a> <li><a href=http://www.lordoftheabyss.com/market>Market Square</a> <li><a href=http://www.lordoftheabyss.com/quests/main>Old Man's Hut</a> <li><a href=http://www.lordoftheabyss.com/hall>Town Hall</a> <li><a href=http://www.lordoftheabyss.com/>link</a> <li><a href=http://www.lordoftheabyss.com/>link</a> <li><a href=http://www.lordoftheabyss.com/>link</a> <li><a href=http://www.lordoftheabyss.com/>link</a> <li><a href=http://www.lordoftheabyss.com/>link</a> <li><a href=http://www.lordoftheabyss.com/>link</a> </td></tr> </table> <center> <br><a href="http://www.lordoftheabyss.com/house.php">Lord of the Abyss's House</a> | <a href="http://www.lordoftheabyss.com/iridia.php" border="0">Iridia Central</a> | <a href="http://www.lordoftheabyss.com/society/mysociety.php?id=10">My Society</a> | <a href="http://www.lordoftheabyss.com/market/index.php?sort=lowcost" border="0">Market Square</a> | <a href="http://www.lordoftheabyss.com/battle/index.php" border="0">Battle</a> | <a href="http://www.lordoftheabyss.com/quests/main/index.php" border="0">Old Man's Hut</a> | <a href="http://www.lordoftheabyss.com/im/index.php">Instant Message</a> | <a href="http://www.lordoftheabyss.com/forum/" border="0">Message Board</a> | <a href="http://www.lordoftheabyss.com/player/find.php" border="0">Find Player</a> | <a href="http://www.lordoftheabyss.com/account/index.php" border="0">Account Settings</a> | <a href="http://www.lordoftheabyss.com/logout.php" border="0">Logout</a><br><br></center> </body> </html> You could try creating a class for that td cell and setting the height in CSS...that's what I'd do, anyway. =/ I've tried that, or I believe I tried what you are implying Quote Link to comment https://forums.phpfreaks.com/topic/63647-table-cell-height/#findComment-317789 Share on other sites More sharing options...
mdnghtblue Posted August 7, 2007 Share Posted August 7, 2007 Was it something like: // HTML <td class="title" width="650">Title!</td> and // CSS td.title { height:20px; vertical-align:top; text-align:center;} ? Quote Link to comment https://forums.phpfreaks.com/topic/63647-table-cell-height/#findComment-317822 Share on other sites More sharing options...
almightyegg Posted August 7, 2007 Author Share Posted August 7, 2007 It was like that yes. Didn't make any difference Quote Link to comment https://forums.phpfreaks.com/topic/63647-table-cell-height/#findComment-317832 Share on other sites More sharing options...
mdnghtblue Posted August 7, 2007 Share Posted August 7, 2007 Tricky...I played around with it a little, and with this: td.title { height: 0px; vertical-align:top; text-align:center; padding-bottom:0px;} in the style sheet, I was able to make the height go down a little bit, but not all the way. =/ Also, you should probably work on being a little more consistent. Such as, including quotes around all your tag values, and making sure everything is lower-case. Goes for your style-sheet too, though I dunno if XHTML takes your style sheet into account (because XHTML shuns capitalization). But still, it'd be easier to follow if everything was consistent. Quote Link to comment https://forums.phpfreaks.com/topic/63647-table-cell-height/#findComment-317864 Share on other sites More sharing options...
wildteen88 Posted August 7, 2007 Share Posted August 7, 2007 Its to do with your table cellspacing and cellpadding which is causing it. Quote Link to comment https://forums.phpfreaks.com/topic/63647-table-cell-height/#findComment-317957 Share on other sites More sharing options...
almightyegg Posted August 7, 2007 Author Share Posted August 7, 2007 In what way is it causing it? How can I adapt it so it will work?? Quote Link to comment https://forums.phpfreaks.com/topic/63647-table-cell-height/#findComment-317991 Share on other sites More sharing options...
almightyegg Posted August 9, 2007 Author Share Posted August 9, 2007 bump Quote Link to comment https://forums.phpfreaks.com/topic/63647-table-cell-height/#findComment-319498 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.