Jump to content

What's the best way to display table data?


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