Jump to content

Grid in Table Rather than List


gamerzfuse

Recommended Posts

I am attempting to make a grid view of an inventory list we have, including images and some brief text beneath them.

The problem is that I can't seem to figure out how to make the table go 3-across?

 

Currently I have:

 

ITEM

 

ITEM

 

ITEM

 

ITEM

 

ITEM

 

ITEM

 

I want:

 

ITEM    ITEM    ITEM

 

ITEM    ITEM    ITEM

 

I was told it required pseudo-matrix width?

Not a clue and googling that was very unrewarding.

 

Thanks!

 

 

Link to comment
Share on other sites

<?php
$items = array('item1', 'item2', 'item3', 'item4', 'item5', 'item6', 'item7', 'item8', 'item9');
echo '<table><tr>';
for($i=0; $i<count($items); $i++){
if($i%3){
	echo '</tr><tr>';
}
echo "<td>{%items[$i]}</td>";
}
echo '</tr></table>';
?>

Link to comment
Share on other sites

<tr><td>any cells between this will be considered one row</td> <td> any of these next to eachother will always go next to one another</td></tr> 

 

(tr = table row)

 

if you wanted to avoid tables...then you could use a combination of different float and clear properties in css :-)

Link to comment
Share on other sites

<tr><td>any cells between this will be considered one row</td> <td> any of these next to eachother will always go next to one another</td></tr> 

 

(tr = table row)

 

if you wanted to avoid tables...then you could use a combination of different float and clear properties in css :-)

 

Took your advice and used <div> items.

Only problem now is that I have some entries that are.. blank?

 

http://www.goodwillsusedcars.com/vehiclesgrid.php

(lots of images to load)

Link to comment
Share on other sites

blank entries eh?

 

Seems like they all loaded ok for me.... that is alot of images....thinking of pagination at some point? :-)

 

Definitely looking into pagination.. the worst part is that it's loading the full images and just sizing them down, not creating thumbnails.

It's a work in progress :)

 

Looking into the fact that you didn't see them, might just be a cache issue.

 

EDIT: Not just my machine. Checked on 3 others.

First two rows load fine, then there starts to be blank <div>s with nothing in them.

Odd.

Link to comment
Share on other sites

It's not blank divs, there's no divs in those spaces' Its your css. between every row you nee to ensure that you clear all the divs. it the middle or left div is a little longer than the right one, the next div will float along side it. or set a specific height for the divs

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.