2013-12-16 146 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>";