此圖顯示了我網站的主頁。顯示來自行中數據庫的項目
http://i163.photobucket.com/albums/t315/smc22_2007/Website.png
我想4行,而不是5
這行是我的PHP代碼:
<?php
$query = "SELECT * FROM UFPProducts";
$results = mysql_query ($query, $connect);
while ($row = @ mysql_fetch_array($results))
{
print
"<div id= 'item'>" .
"<p>Product id ".$row["ProductID"]."</p>".
"<p><img src=".$row["Image"]."></p>".
"<p>£".$row["Price"]."</p>".
"<p>".$row["Description"]."</p>".
"</div>";
}
下面是上面的CSS:
#item {
width:100px;
text-align:center;
border: 1px solid #D9D9D9;
padding: 0px;
list-style: none;
width: 150px;
float: left;
margin-right: 15px;
margin-bottom: 15px;
border-radius: 10px;
-moz-border-radius: 10px; /* firefox rounded corners */
-webkit-border-radius: 10px; /* Safari rounded corners */
min-height: 220px;
}
#item li h1 {
text-align:center:
}
#item li#white{
min-height: 220px;
}
如何顯示4行而不是5行?
三江源
變化幅度,正確的價值或商品的寬度,你最好使用jquery/JS計算寬度的值並以這種方式適用於不同的尺寸 –
計算行數並在CSS中使用'clear'屬性。 – Nahuelistico
我沒有看到任何代碼將行限制爲五個元素。有沒有在這個地方定義的寬度?如果是這樣,請減小寬度,否則只需使用計數器。 – j08691