這裏是我的代碼:如何在使用循環打印時在DIV上應用邊距?
<?php
$qr = mysql_query("SELECT * FROM products");
while($res = mysql_fetch_array($qr)):
?>
<div class="box">
<p><?php echo $res[1]; ?></p>
<img src="<?php echo $res[3]; ?>" width="100" /><br />
<a href="<?php echo $res[4]; ?>">View Data Sheet</a>
</div>
<?php
endwhile;
?>
我想取出的記錄是這樣http://jsfiddle.net/CqYhE/3/
輸出請幫我,我怎麼能申請的10px的邊距兩側(左&右),只在使用php循環打印時,每行的中心div。
你在一排有多少個盒子? –
如果你需要使用nth-child的幫助,你可以訪問http://codepen.io/RadLikeWhoa/full/cAJEo看看你想要什麼 – ashley
@PankitKapadia,單行3盒 – Moeen