开发者

Display the datas coming from database (side by side)

开发者 https://www.devze.com 2023-04-05 06:01 出处:网络
show http://img28.imageshack.us/img28/3052/unledcwk.png this is my html and the name and the picture is taken from php (mysql).I only want to make 3 of these things(name and picture) side by side not

show http://img28.imageshack.us/img28/3052/unledcwk.png

this is my html and the name and the picture is taken from php (mysql).I only want to make 3 of these things(name and picture) side by side not like a queue.So i want the name asdasddasd is in the right of the 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("开发者_StackOverflowSELECT * 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>';
       ?>

this is the code that makes them.How can i make the side by side showing.

this is the css of the box

.box {
margin-bottom: 10px;
margin-right: 10px;
float: left;
height: auto;
width: 207px;
}


The div you are using to display the image subtext is a block level element so it is pushing the content to the next line.

You need to put echo '<div class="box">'; inside the while loop, along with the corresponding </div>

0

精彩评论

暂无评论...
验证码 换一张
取 消