【问题标题】:Align text in a while loop [closed]在while循环中对齐文本[关闭]
【发布时间】:2013-12-16 20:25:16
【问题描述】:

如何对齐在 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)在右边对齐

【问题讨论】:

  • 更具体,你想要什么?

标签: php html css


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

【讨论】:

    【解决方案2】:

    PHP 是服务器脚本,所以,只要回显,无论你需要什么标记......

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

    【讨论】:

      【解决方案3】:

      试试这个 在内联本身中添加样式

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

      【讨论】:

        猜你喜欢
        • 2016-10-21
        • 2016-10-12
        • 2020-07-27
        • 1970-01-01
        • 2016-03-14
        • 1970-01-01
        • 2019-02-10
        • 2014-02-02
        • 1970-01-01
        相关资源
        最近更新 更多