php - Align products in Grid type instead of list? -



php - Align products in Grid type instead of list? -

i've issue in displaying products in grid type. instead of grid type, products arranged in left side in top-to-bottom format.

i've div called content displays list of products in left side , cart items on right side. code display products:

<div id="content"> <h2>spices</h2> <?php $query="select * products"; $result= mysqli_query($db,$query); while($row=mysqli_fetch_array($result)) { $productname=$row['name']; $price=$row['price']; ?> <div class="product1"> <h3><?php echo $productname; ?></h3> <img src="images/bp.png" width="170" height="140"> <p>starting <span> rs. <?php echo $price; ?> </span></p> <div id="imgad"> <a href="#"><img src="images/add-to-cart.png"></a> </div> <?php } ?> </div> </div> <?php require_once("sidebar.php");

css

#content { width: 700px; height: 1200px; padding: 5px; float: left; border: 1px solid #987a7a; } #sidebar { width: 250px; height: 500px; padding: 5px; float: right; border: 1px solid #987a7a; } .product1 { width: 210px; height: 300px; border: 1px solid #c9c5c5; text-align: center; float: left; display: block; }

the current issue (all aligned left top-to-bottom)

expected result:

.product1 { width: 210px; height: 300px; border: 1px solid #c9c5c5; text-align: center; display: inline-block; }

display:inline-block show content in line

update:

after watch demo pagedemo can problem divs not closing

php html mysql css

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -