中心我的动态表css php的内容

时间:2013-04-23 08:39:08

标签: php css styles echo center

我试图将动态表格的内容集中在一起。我正在使用jquery库中的选定元素。我希望我桌子上的所有文字都在中心。我已经尝试了所有常用的方法,但我不能将文本放在中心。 我的代码是:

<tbody id="tbody_chosen">
<?php foreach($table as $row){
$num = $row->total_quantity - $row->available_quantity;
echo "<tr>
        <td>{$row->id}</td>
        <td>{$row->name}</td>
        <td>{$row->total_quantity}</td>
        <td>{$num}</td>
        <td>{$row->available_quantity}</td>
        <td>{$row->inOrder}</td>";
if(have_access("manager"))
    //TODO here we have to use the product's supplier ID
    echo "<td>
            <input type=\"checkbox\" name=\"selector[]\" value=\"{$row->id}\" id=\"selector-{$row->id}\"/>
            <input type=\"hidden\" name=\"selector_id[]\" id=\"selector_id-{$row->id}\" value=\"{$row->supplied_by}\" />
        </td>";
echo "</tr>";
} ?>
</tbody>

2 个答案:

答案 0 :(得分:1)

在你的tr

中给出这个
<tr style='text-align:center;'>

答案 1 :(得分:0)

td,th {align:center;你的CSS