2013-12-16 46 views
-4

如何對齊是在一個while循環生成的文本對齊文本

例子:

while ($row = mysql_fetch_array($query)){ 


echo "<strong>E1:</strong>".$row['Ex1']."<br>"; 
echo "<strong>E2:</strong> ".$row['Ex2']."<br>"; 
echo "<strong>E3:</strong> ".$row['Ex3']."<br>"; 
echo "<strong>E4:</strong> ".$row['Ex4']."<br>"; 
echo "<strong>E5:</strong> ".$row['Ex5']."<br>"; 
echo "<strong>E6:</strong> ".$row['Ex6']."<br>"; 
} 

現在定位是不是好,我想在左邊,結果(E1在右對齊EX1/6)

+0

進行更具體的,你想要什麼這個 增添風采? – Dev

回答

1
echo "<strong style='float:left;'>E1</strong> 
     <span style:float:right;'>.$row['Ex1']."</span><br>";` 
1

PHP是服務器腳本程序,因此,只是呼應,無論標記u需要標記.....

echo "<span style='float:left'><strong>E1:</strong> 
</span><span style='float:right'>".$row['Ex1']."</span><br>"; 
0

嘗試在內嵌本身

echo "<span style='float:left'><strong>E1:</strong> 
</span><span style='float:right'>".$row['Ex1']."</span><br>";