我试图在下面的示例中放置一个标签,但表格显示在 tableWrapper div 之外,tableWrapper div 正确显示我想要但表格在它之外,我不明白我在做什么错,有人可以帮忙吗?:
//the buttons
$html .= '<p><form method="post" action = "DBTest.php" >
<input type="submit" name="create" value="Create">
<input type="submit" name="save" value="Save">
<input type="submit" name="reset" value="Reset">
</form></p>';
//start table
$html.= '<div id = "tableWrapper"><table>';
foreach($rows as $row)
{
$id= $row['id'];
$title = $row['title'];
$year = $row['YEAR'];
//put everything on a table
$html.= "<tr><td>" . $row['id'] . "</td><td>" . $row['title'] . "</td><td>" . $row['year'] . "</td><td>";
}
$html.= '</table></div>';
//the main body
$alpha['main'] = <<<EOD
{$html}
EOD;
这是我的 tablWrapper div:
#tableWrapper{
clear:both;
width: 350px;
height: 350px;
}
这是我的表格 css:
table {margin-bottom:1.4em;}
th {font-weight:bold;background:black;color:white;}
th,td,caption {padding:4px 10px 4px 5px;}
tbody tr:nth-child(even) td {background:#A1912A11;}
tbody tr:hover td {background:#9E9E80;}
先感谢您