我想讓圖像自動處於水平狀態,我應該再放一個div嗎?因爲圖片將被它們的位置自動保存圖像不能在水平顯示
這是我的CSS:
.row{
display: block;
height:auto;
width:auto;
}
.box_img2{
width: 20px;
padding : 5px;
margin-bottom:5px;
background-color:white;
height:30px;
float:center;
}
這是我的PHP:
<?php
include('../connection/connect.php');
$result = $db->prepare("SELECT * FROM candposition ORDER BY posid ASC");
$result->bindParam(':userid', $res);
$result->execute();
for($i=0; $row = $result->fetch(); $i++){
$dsds=$row['posid'];
$resulta = $db->prepare("SELECT sum(votes) FROM candidates WHERE posid= :a");
$resulta->bindParam(':a', $dsds);
$resulta->execute();
for($i=0; $rowa = $resulta->fetch(); $i++){
$dsada=$rowa['sum(votes)'];
}
echo '<div style="margin-top: 18px;">';
echo '<strong>'.$row['pos_name'].' '.'</strong><br>';
$results = $db->prepare("SELECT * FROM candidates,student WHERE candidates.idno=student.idno AND posid= :a ORDER BY votes DESC");
$results->bindParam(':a', $dsds);
$results->execute();
for($i=0; $rows = $results->fetch(); $i++){
if($dsds=='Commissoner'){
echo $rows['prog_id'].$rows['prog_id'].' '.$rows['prog_name'].' = '.$rows['votes'];
}else {
echo "<div class='row'><div class='box_img2'><br>";
echo '<img src="savephp/images/'.$rows['image'].'" width="60" height="70px" />'.' '.$rows['lastname'].', '.$rows['firstname'].'<br>'.' = '.$rows['votes'];
echo '</div>';
}
echo '</div>'.'</div>';
$sdsd=$dsada
?>
<br><br><br><br><br>
<img src="../img/percent.gif"width='<?php echo(100*round($rows['votes']/($sdsd),2)); ?>'height='10'>
<?php
if ($rows['votes']==0){
echo "<br>";}
else {
echo(100*round($rows['votes']/($sdsd),2)); ?>%<br>
<?php
}
echo '</div>';
}
?>
<?php
}
?>
以下是圖像: I want to be like this
「水平顯示」是什麼?你的意思是你想要多個圖像水平對齊?你的語言不夠具體。顯示生成的HTML和CSS,最好是http://fiddlesalad.com/html/。你需要更清楚你想做什麼以及做錯了什麼。如果很難解釋一下小提琴展示你的成就,並用照片來展示你想要的樣子。然後,我們確切知道如何修改你的小提琴以獲得你需要的外觀。 –
我希望它會在同一行對齊 –