0

how it possible to create grid layout with 3 or 4 or 5 items per row in php
something like this :
a2cbc4d55772c3b0432d4392d13838e0

I have this solution, do you think its effecient

<?
$count = 0;
$num_images = mysql_num_rows($rs);
while($data = mysql_fetch_assoc($rs)) {
if ($count == 0 || ($count %3 == 0 && $count < $num_images)) { 
?>
<div class="row">
<? } ?>
<span class="imagepluscontainer">
<a href="#"><img src="pictures/thumbs/xxxx.jpg" width="150" height="150" /></a>
</span>
<?
$count++;
if ($count %3 == 0) {
?>
</div>
<? } }?>
3
Contributors
3
Replies
14
Views
4 Years
Discussion Span
Last Post by OsaMasw
0

Specify a width of 20 - 33% for each item; display each one within <li>, such that if you had no styling, it would be a single bulleted list of pictures.

Edited by Unimportant

0

Be sure to close your div correctly. Line 14 only executes if the row count is a multiple of 3. Here is my version (using tables).

Edited by pritaeas

0

I'll try pritaeas method tomorrow since its weekend here :P, and I'll return with result.
thanks for the help.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.