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>
<? } }?>

Recommended Answers

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.

Jump to Post

All 3 Replies

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.

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).

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.