PHP输出的表格怎么居中
要使PHP输出的表格居中,可以在HTML的table标签中添加style属性,并设置属性值为"margin: 0 auto;"。这样可以将表格居中显示。
以下是一个示例代码:
```php
<?php
echo '<table style="margin: 0 auto;">';
echo '<tr>';
echo '<th>标题1</th>';
echo '<th>标题2</th>';
echo '</tr>';
echo '<tr>';
echo '<td>数据1</td>';
echo '<td>数据2</td>';
echo '</tr>';
echo '</table>';
?>
```
在上面的代码中,将table标签的style属性设置为"margin: 0 auto;",这样就将表格居中显示了。
还没有评论,来说两句吧...