如何删除标题和表格之间的空白行?谢谢!
<?php
echo "<h3>Presentaciones</h3>";
echo "<table border='1'>";
echo "<tr>";
echo "<td>row 1, field1</td>";
echo "<td>row 1, field2</td>";
echo "<td>row 1, field3</td>";
echo "</tr>";
echo "<tr>";
echo "<td>row 2, field1</td>";
echo "<td>row 2, field2</td>";
echo "<td>row 2, field3</td>";
echo "</tr>";
echo "</table>";
?>
答案 0 :(得分:0)
将其添加到您的css文件中:
h3 {
margin-bottom: 0px;
}
<h3>Presentaciones</h3>
<table border='1'>
<tr>
<td>row 1, field1</td>
<td>row 1, field2</td>
<td>row 1, field3</td>
</tr>
<tr>
<td>row 2, field1</td>
<td>row 2, field2</td>
<td>row 2, field3</td>
</table>
答案 1 :(得分:0)
在margin-bottom: 0
中添加h3
。
浏览器具有默认样式,您必须添加自己的规则才能覆盖它们。
以下是PHP输出为HTML:
h3{
margin-bottom: 0;
}
&#13;
<h3>Presentaciones</h3><table border="1"><tbody><tr><td>row 1, field1</td><td>row 1, field2</td><td>row 1, field3</td></tr><tr><td>row 2, field1</td><td>row 2, field2</td><td>row 2, field3</td></tr></tbody></table>
&#13;