[英]How to order divs side by side and centered when get datas from database in php and css
[英]Display the datas coming from database (side by side)
顯示http://img28.imageshack.us/img28/3052/unledcwk.png
這是我的html,名稱和圖片取自php(mysql)。我只想將這些東西中的3個(名稱和圖片)並排而不是隊列。所以我想要名字asdasddasd在右邊asdasd。
<?php
echo '<div class="box">';
$kategori=$_GET["kategori"];
$con = mysql_connect("localhost","root","root");
if (!$con){die('Could not connect: ' . mysql_error());}
mysql_select_db("marmaris", $con);
$bilgi= mysql_query("SELECT * FROM $kategori ");
while($sutun= mysql_fetch_array($bilgi))
{
$name=$sutun["name"];
$resb=$sutun["resbuyuk"];
echo '<a href="#"><div id="texttitle">'.$name.'</div></a>';
echo '<img src="upload/'.$resb.'" width="202" height="154" alt="resim" style="background-color: #000000" />';
echo '<div id="textdetailup"><a href="#">Detayları görmek için tıklayın.</a></div>';
}
echo '</div>';
?>
這是制作它們的代碼。我怎樣才能並排顯示。
這是盒子里的css
.box {
margin-bottom: 10px;
margin-right: 10px;
float: left;
height: auto;
width: 207px;
}
用於顯示圖像子文本的div是塊級元素,因此它將內容推送到下一行。
你需要把echo '<div class="box">';
在while循環中,以及相應的</div>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.