Hi,

I am extracting a set of categories from a database and want them to disply in lines of three. They are each in their own div. I need them to look like this:

div1 div2 div3
div4 div5 div6

The code is PHP but I need to know how to make the divs start on a new line every third time so I'm posting this in this forum.

<?php
   	     $cat_set = display_categories();
            echo "<div>";
            while ($row = mysql_fetch_array($cat_set)){

               if ($row['cat_id'] % 4 == 1 && $row['cat_id'] != 1){
                   echo "<div style='padding:33px; width: 25%; clear:left;'><h4 style='text-align:center;'>".$row['cat_name']."<br /><img src=".$row['image']." /></div>";
             }

             else {
                 echo "<div style='padding:33px; width: 25%; float:left;'><h4 style='text-align:center;'>".$row['cat_name']."<br /><img src=".$row['image']." /></div>";
             }

         }
         echo "</div>";
         ?>

Thanks

As so often happens with these things, as soon as help is requested, I fixed it. I added float:left to the 'if' div and that did the trick. I'll leave it here in case anyone else has the same problem.