Jump to content

PHP/CSS


Twist3d

Recommended Posts

Ello.

Well, im trying to make a toplist for a website.

And i think its an issue with CSS but i don't know.

 

http://toplist2.ulmb.com/index.php

 

Thats the website.

Now what im trying to do, is change the each cell padding so even text won't change its size.

If you look on that site, you will see:

 

cocks0 (Sorry for swearing, friends ^^)

And TestVer are making the cell size different. This is because those 2 are the smallest out of the two.

Can anyone help me fix?

 

Here is the code of the index.php

 

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Blah</title>
<!--[if gte IE 5]>
<link rel="stylesheet" type="text/css" href="style.css" />
<![endif]-->
<![if !IE]>
<link rel="stylesheet" type="text/css" href="style2.css" /><![endif]>
</head>

<body>

<div id="header">
  <div class="logo">
    <h1>RSPS Toplist</h1>
    <h2>Just for you</h2>
  </div>

<div id="nav">
<ul>
<li><a href="#">Homepage</a></li>
<li><a href="#">Toplist</a></li>
<li><a href="#">Add Server</a></li>
<li><a href="#">Server Search</a></li>
<li><a href="#">Server CP</a></li>
</ul>
</div>

<div id="adsense">
<script type="text/javascript"><!--
google_ad_client = "pub-9506960477574672";
/* 468x60, created 1/9/10 */
google_ad_slot = "9429519985";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>

<div id="goldentoplist">
<center><img src="golden.png" /></center>
<table id="goldentable">
<tr>
  <th>Name</th>
  <th>Description</th>
  <th>Banner</th>
</tr>
<tr>
<td>Server 1</td>
<td>test</td>
<td>f off</td>
</tr>
<tr class="alt">
<td>dfsdfsdf</td>
<td>as</td>
<td>sssss</td>
</tr>
</table>
<div class="howto">
<a href="#">How to get golden</a>
</div>
</div>


<?php

require "connect.php";

//max displayed per page
$per_page = 10;

//get start variable
$start = $_GET['start'];

//count records
$result=mysql_query("SELECT COUNT(*) FROM data") or die( mysql_error() ); 
$record_count = mysql_result($result , 0); 

//count max pages
$max_pages = $record_count / $per_page; //may come out as decimal

if (!$start)
   $start = 0;
   
//display data
$get = mysql_query("SELECT * FROM data ORDER BY votes DESC LIMIT $start, $per_page"); 
$G=$start;
while ($row = mysql_fetch_assoc($get))
{
if (strlen($row['sdetail']) > 10) // if len is more than 10 
{ // shorten it and add trailing dots. 
$sdetail = substr($row['sdetail'], 0, 100) . "..."; 
} 
else // len is less than 10, use original description. 
{ 
$sdetail = $row['sdetail']; 
} 

// get data
$sname = $row['sname'];
$svotes = $row['votes'];
$id = $row['ID'];

$G++;
?>

<div id="toplist">
<table id="table">
<tr>
  <th>Rank</th>
  <th>Name</th>
  <th>Description</th>
  <th>Votes</th>
</tr>
<tr>
<td><p><?php echo $G; ?></p></td>
<td><?php echo $sname; ?></td>
<td><?php echo " $sdetail"; ?></td>
<td><?php echo $svotes; ?></td>
</tr>
</table>
</div>

<?php
}
echo "<center>";
//setup prev and next variables
$prev = $start - $per_page;
$next = $start + $per_page;

//show prev button
if (!($start<=0))
  
       echo "<a href='viewtoplist.php?start=$prev'>Prev </a>";

//show page numbers

//set variable for first page
$i=1;
for ($x=0;$x<$record_count;$x=$x+$per_page)
{
if ($start!=$x)
    echo "<a href='viewtoplist.php?start=$x'>$i </a>";
else
    echo "<a href='viewtoplist.php?start=$x'><b>$i </b></a>";
$i++;
}
//show next button
if (!($start>=$record_count-$per_page))
       echo "<a href='viewtoplist.php?start=$next'>Next</a>";
echo "</center>";
?>

<div id="adsense">
<script type="text/javascript"><!--
google_ad_client = "pub-9506960477574672";
/* 468x60, created 1/9/10 */
google_ad_slot = "9429519985";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>

<div id="footer">
<p>Designed by <a href="http://projectevolution.comoj.com">Project Evolution Ltd.</a> - 2010</p>
<a href="http://validator.w3.org/check?uri=referer">
    <img style="border:0;width:88px;height:31px"
        src="http://www.w3.org/Icons/valid-xhtml10"
        alt="Valid XHTML 1.0 Transitional" />
</a>
 
<a href="http://jigsaw.w3.org/css-validator/check/referer">
    <img style="border:0;width:88px;height:31px"
        src="http://jigsaw.w3.org/css-validator/images/vcss-blue"
        alt="Valid CSS!" />
</a>
</div>
</div>

</body>
</html>

 

And here is the CSS of the table's

 

#toplist {
margin-top: 0px;
margin-left: 25px;
margin-right: 25px;
border-style: solid;
border-width: 0px;
border-color: #FFFFFF;
}

#table {
width: 400px;
margin: 0px auto;
/*margin-left: 2.5%;
margin-right: auto;*/
margin-top: 10px;
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
width: 100%;
border-collapse: collapse;
}

#table td, #table th {
font-size: 1em;
border: 1px solid #105377;
padding: 3px 7px 2px 7px;
}

#table th {
font-size: 1.1em;
text-align: center;
padding-top: 5px;
padding-bottom: 4px;
background-color: #105377;
color: #FFFFFF;
}

#table td {
padding-top: 10px;
padding-bottom: 10px;
text-align: center;
background-color: #FFFFFF;
}

#table tr.alt td {
color: #000000;
background-color: #ADD8E6;
}

#table p {
font-size: 25;
text-align: center;
font-weigt: bold;
}

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.