我正在创建一个网站,但到目前为止,我的网站设计中存在空白,这是不需要的,因为我不希望每个块之间有任何空白(例如,我不希望导航栏//黑色矩形周围有任何空白)。我正在使用主页的HTML表来创建我的网站,到目前为止,每个单元格之间几乎没有白色的空白。我想摆脱它,但我不确定如何摆脱。我不确定是否必须添加CSS,但我仍然是一个全新的html和编码。
这是我的编码
<table style="width:100%"; cellpadding="0"; cellpacing="0">
<tr>
<td style="background-color: #869d92" ;class="auto-style1" rowspan="4" class="auto-style1">f</td>
<td style="background-color: #e9e9e9; height:150px">
<asp:ContentPlaceHolder ID="cphh_header" runat="server">
</asp:ContentPlaceHolder>
</td>
<td style="background-color: #869d92";class="auto-style1" rowspan="4">f</td>
</tr>
<tr>
<td style="background-color:black; height:1.7cm">
<asp:ContentPlaceHolder ID="cphh_nav" runat="server">
</asp:ContentPlaceHolder>
</td>
</tr>
<tr>
<td style="background-color:white; height:1307px">
<asp:ContentPlaceHolder ID="cph_main" runat="server">
</asp:ContentPlaceHolder>
</td>
</tr>
<tr>
<td style="background-color: #7a7a7a;height:4.82cm">
<asp:ContentPlaceHolder ID="cphfooter" runat="server">
</asp:ContentPlaceHolder>
</td>
</tr>
</table>
要删除表区域中的所有空白,请使用border-collapse: collapse;
。要删除网站周围的所有空白,请使用margin: 0;
。下面是一个基本的样式表:
body { margin: 0; }
table { border-collapse: collapse; }