Vivid Lust Posted September 17, 2008 Share Posted September 17, 2008 Hey, I have this Leaderboard script at: http://onestamp.co.uk/projects/phishfriends/leader.php Now what is strange, is that when a new field is added to the table, the gap above that table gets bigger, quite weird! Maybe the script may explain why to few: <?php session_start(); ?> <?php include("siteincludes/header.php"); ?> <!-- content block START --> <div id="conent"> <?php include("siteincludes/sidebar.html"); ?> <!-- left column start--> <div class="left_col"> <div class="db1"> <div class="db1_title"> <h3>Leaderboard - Top 20 Phishers</h3> </div> <div class="db1_content"> <div class="db1_container"> <?php require("includes/db.php"); $sql = "select * from users order by `s_phish` desc"; $result = mysql_query($sql, $link) or die(mysql_error()); ?> <center> <table cellpadding="0" width="50%" cellspacing="0"> <tr> <td> Rank </td> <td> Name </td> <td> Phishes </td> </tr> <?php $rank = 0; while ($row = mysql_fetch_array($result) AND $rank < 20) { $rank++; // adds 1 echo "<tr><td>"; echo $rank; echo "</td><td>"; echo " <a href='profile.php?id="; echo $row['id']; echo "'>"; echo $row['name']; echo "</a> "; echo "</td><td>"; echo $row['s_phish']; // put HTML break to end line echo "</td></tr>"; echo "<br />"; } ?> </table> </center> <!-- and more html below here... --> Thanks if you can help. Quote Link to comment https://forums.phpfreaks.com/topic/124694-php-formating-html/ Share on other sites More sharing options...
F1Fan Posted September 17, 2008 Share Posted September 17, 2008 Try getting rid of the old <center> tags and just add align="center" to the <table> tag. Maybe that old <center> tag is taking all spaces literally like the pre tag. Quote Link to comment https://forums.phpfreaks.com/topic/124694-php-formating-html/#findComment-644067 Share on other sites More sharing options...
Maq Posted September 17, 2008 Share Posted September 17, 2008 Not sure why this would make a difference, but this is the place where the spaces seems to be generated from. Try to remove the divs in between: Leaderboard - Top 20 Phishers Quote Link to comment https://forums.phpfreaks.com/topic/124694-php-formating-html/#findComment-644089 Share on other sites More sharing options...
Vivid Lust Posted September 17, 2008 Author Share Posted September 17, 2008 Doesn't do anything about the spaces, have a look: http://onestamp.co.uk/projects/phishfriends/leader.php Quote Link to comment https://forums.phpfreaks.com/topic/124694-php-formating-html/#findComment-644091 Share on other sites More sharing options...
F1Fan Posted September 17, 2008 Share Posted September 17, 2008 I'm thinking you may have a vertical-align: center; somewhere in your CSS. Quote Link to comment https://forums.phpfreaks.com/topic/124694-php-formating-html/#findComment-644093 Share on other sites More sharing options...
Maq Posted September 17, 2008 Share Posted September 17, 2008 Post your CSS code for these two divs: Quote Link to comment https://forums.phpfreaks.com/topic/124694-php-formating-html/#findComment-644097 Share on other sites More sharing options...
Vivid Lust Posted September 18, 2008 Author Share Posted September 18, 2008 That didnt work, Heres my css: .db1 .db1_content { background:#fff url('../images/db1_content_bg.png') no-repeat scroll top right; } .db1 .db1_container { background: url('../images/db1_content_bg.png') no-repeat scroll top left; padding: 10px; position:relative; } Quote Link to comment https://forums.phpfreaks.com/topic/124694-php-formating-html/#findComment-644743 Share on other sites More sharing options...
F1Fan Posted September 18, 2008 Share Posted September 18, 2008 You have so many divs on that page, that I'm getting a little lost. Never the less, try adding the "vertical-align: top;" to the CSS of any element that those items are contained in. If that doesn't work, try playing around with it. Try messing it up. Sometimes that helps me see something that I was blind to before. Quote Link to comment https://forums.phpfreaks.com/topic/124694-php-formating-html/#findComment-644754 Share on other sites More sharing options...
Vivid Lust Posted September 18, 2008 Author Share Posted September 18, 2008 Ive removed those divs and It still happens. I think its the PHP generating the table... Quote Link to comment https://forums.phpfreaks.com/topic/124694-php-formating-html/#findComment-644762 Share on other sites More sharing options...
F1Fan Posted September 18, 2008 Share Posted September 18, 2008 PHP won't automatically generate a table. I suggest you add the vertical-align: top; to ALL the divs. I think the more likely situation than PHP generating a table is that the divs are defaulting to vertical-align: middle;, because it's not explicitly set. Quote Link to comment https://forums.phpfreaks.com/topic/124694-php-formating-html/#findComment-644771 Share on other sites More sharing options...
Vivid Lust Posted September 18, 2008 Author Share Posted September 18, 2008 shall I just add vertical-align: top; to the body{} ?? Quote Link to comment https://forums.phpfreaks.com/topic/124694-php-formating-html/#findComment-644778 Share on other sites More sharing options...
F1Fan Posted September 18, 2008 Share Posted September 18, 2008 Yes, but that will only vertically align the elements in the body. Your problem is that the data needs to be vertically aligned in a specific div. But, since we don't know which div is the problem, I suggest either adding it to all of them, or one by one until you see something change. Quote Link to comment https://forums.phpfreaks.com/topic/124694-php-formating-html/#findComment-644781 Share on other sites More sharing options...
Vivid Lust Posted September 18, 2008 Author Share Posted September 18, 2008 I removed the <?php echo "<br />"; ?> From the code and its now fine! Thanks for all the suggestions though. Quote Link to comment https://forums.phpfreaks.com/topic/124694-php-formating-html/#findComment-644827 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.