Jump to content

What's the best way to display table data?


Kryptix

Recommended Posts

I have a <div> that's 250px wide and inside that I want to display the top forum posters like:

 

 

1. User                3,298

2. Another User  2,385

 

...etc

 

 

I want their post count to be centred right and I want the rest to he centred left. Is this possible to do somehow just using a <ul> <li>?

 

If not, what's the best/sleekest way to do it using the least code as possible?

 

Cheers

The rule is to not use tables for LAYOUT.  That means: don't use tables to organize your site, don't use tables to make an image float to the right of a paragraph, and don't use tables to make your header look nice.  DO use tables for TABLES.  The tag is not deprecated, it's just incorrectly used.

Are you using PHP to loop through database results?

 

If so then just use the loop to add numbers.

$i = 1;

while($row = mysql_fetch_assoc($result)) {
     echo '<tr>
          <td>' . $i . '</td>
          <td>' . $row['username'] . '</td>
     </tr>';
$i++;
}

I am, and I usually do that, but I'm trying to make the website as fast and efficiently as possible with the least amount of code, I'd much sooner use a list to auto add numbers to the list, but wasn't sure how I could incorporate that into a table.

 

Could I not just put a <span>post count</span> inside the <li> and float it to the right or should I definitely be using a table?

  • 4 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.