Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Making columns with a long list

New Here ,
Feb 28, 2012 Feb 28, 2012

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>

TOPICS
Server side applications
945
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Feb 29, 2012 Feb 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/

Translate
LEGEND ,
Feb 28, 2012 Feb 28, 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Feb 29, 2012 Feb 29, 2012

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 29, 2012 Feb 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/

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 04, 2012 Mar 04, 2012
LATEST

That's a great article, thank you

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 04, 2012 Mar 04, 2012

Thank you everyone!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines