在输入表单上居中显示文字

时间:2018-09-15 09:55:06

标签: php css html-table center

我已经搜索了论坛,但是找不到可能是一个简单问题的答案。我有一个Form,可以将标题行的文本居中,但不能将文本放在后续的“输入”行上。我尝试使用CSS(尽管不是很熟练)。代码如下。有人可以帮忙吗?

$a = array("1","2","3","4","5","6","7","8","9","10");
$b = array("4","5","4","3","4","5","3","4","4","3");

$form = "<form method=\"post\">";  
$form .= "<table  border=\"1\"  cellspacing=\"0\" cellpadding=\"0\"> ";
$form .= "<tr>";
$form .= "<td width = \"10\" align = \"center\">A</td> ";
$form .= "<td width = \"10\" align = \"center\">B</td> ";
$form .= "</tr>";

for ($i = 0; $i <= 9; $i++)
{
    $form .= "<tr>";
    $val = "t_".$i;
    $val1 = $a[$i];
    $form .= "<td width = \"10\" align = \"center\"><input type=\"text\" ";
    $form .= "name=".$val." value = ".$val1." readonly></td> ";
    $val2 = "v_".$i;
    $val3 = $b[$i];
    $form .= "<td width=\"10\" align =\"center\"><input type=\"text\" ";
    $form .= "name=".$val2." value = ".$val3." readonly></td> ";
    $form .= "</tr>";
}

$form .= "</table>";
$form .= "</form>";
echo ($form);

1 个答案:

答案 0 :(得分:0)

您可以这样做-

{{1}}