Posted by Angelos on 09/05/05 15:16
Hello,
I have the folowing code looping thru a result set from the Database and
displaying a list of products.
I want to use CSS to display 3 products for each line ... or any number of
products that will fit in a line and look nice.
So from the php side How can I do something for every 3 records e.x every 3
records echo "<ul>".
Without any CSS it will display them vertically....
/***************************************************/
echo "<ul>";
while ($row_newProd=mysql_fetch_assoc($new_products))
{?>
<li>
<?php echo $row_newProd['products_shrt_desc']; ?><br>
<div align="center"><a href="index.php?products_id=<?php echo
$row_newProd['products_id']; ?>"><img src="/images/thumb_<?php echo
$row_newProd['products_img']; ?>" border="0" ></a></div>
<p><?php
display_product_price($row_newProd['products_price'],$row_newProd['products_offer']);
?></p>
</li>
<? }
echo "</ul>";
/************************/
css:
#new_products ul {
margin:0px;
list-style-type: none;
text-align:center;
padding: 0px;
}
#new_products ul li {
font-size:0.8em;
display:inline;
float:left;
/*border: 1px dashed #CCCCFF;*/
width:30%;
margin:2px;
}
/**************************************/
If you've done something like that, you know what I mean.
So if you have any Idea give me a hint please.
Regards
Angelos.
Navigation:
[Reply to this message]
|