Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/257.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/33.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
将动态表css php的内容居中_Php_Css_Styles_Echo_Center - Fatal编程技术网

将动态表css php的内容居中

将动态表css php的内容居中,php,css,styles,echo,center,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>{$

我正在尝试将动态表的内容居中。我正在使用从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>

把这个放在你的tr里

<tr style='text-align:center;'>


td,th{align:center;}在你的CSS中

在你的CSS文件中:
tr{text align:center;}
不工作我已经试过了,我想让元素居中。然后给出同样的结果,它不工作。它必须不使用double“可能是的,你把它改为single qoute,因为你正在使用php打印它。