Skip to main content
Known Participant
February 29, 2012
Answered

Making columns with a long list

  • February 29, 2012
  • 2 replies
  • 911 views

I preformed a query and got a long list.  The output doesn't take up that much horizontal space and so I'd like to make two columns with it to save on scrolling.  Is that possible with CSS?

Here's my list looks like this:

Name: Snowfresh
Brewer: Edelweiss
Overall: 3.5
Name: Zepplin
Brewer: Leibringer
Overall: 3

And the code:

<p>German List:</p>

<table width="182" height="145" border="0">

  <?php

//Puts it into an array

while($info = mysql_fetch_array( $data )) {

//Outputs the image and other data ?>

  <tr>

    <td><?php echo  "<img src=http://localhost/beer_diary/images/beer_tasted_profile/".$info['image_id'] ."><br/>";?></td>

    <td><?php echo "<b>Name:</b> ".$info['beer_name']. "<br> ";

    echo "<b>Brewer:</b> ".$info['brewer']. "<br> ";

    echo "<b>Overall:</b> ".$info['overall_id']; }?></td>

  </tr>

</table>

<p> </p>

This topic has been closed for replies.
Correct answer Ben M

Yea, CSS3 columns are about as helpful as CSS3 regions at this point.  I'd recommend this article for turning a list into columns:

http://www.alistapart.com/articles/multicolumnlists/

2 replies

ggourdeAuthor
Known Participant
March 5, 2012

Thank you everyone!

Participating Frequently
February 29, 2012

Do you want the data to flow left to right, then down, or run like newspaper columns? For the former, you can use a horizontal looping technique; basically just a nested loop that outputs two rows from the database for every row on the page. For the latter, CSS3 supports newspaper columns now. I've not used that method, but you can google it.

Rob Hecker2
Legend
February 29, 2012

The CSS3 newspaper-type columns work well, except that no version of Internet Explorer will be able to render them.

Ben MCommunity ExpertCorrect answer
Community Expert
February 29, 2012

Yea, CSS3 columns are about as helpful as CSS3 regions at this point.  I'd recommend this article for turning a list into columns:

http://www.alistapart.com/articles/multicolumnlists/