关于table 中td和th对齐问题 。求助
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<th style="width:30px; text-align:center; ">分支名称</th>
<th style="width:80px; text-align :center ;">日期</th>
<th style="width:30px; text-align:center;">1</th>
<th style="width:30px; text-align:center;">2</th>
<th style="width:30px; text-align:center;">3</th>
<th style="width:30px; text-align:center;">4</th>
<th style="width:30px; text-align:center;">5</th>
<th style="width:30px; text-align:center;">6</th>
<th style="width:30px; text-align:center;">7</th>
<th style="width:30px; text-align:center;">8</th>
<th style="width:30px; text-align:center;">9</th>
<th style="width:30px; text-align:center;">10</th>
<th style="width:30px; text-align:center;">11</th>
<th style="width:30px; text-align:center;">12</th>
<th style="width:30px; text-align:center;">13</th>
<th style="width:30px; text-align:center;">14</th>
<th style="width:30px; text-align:center;">15<th>
<th style="width:30px; text-align:center;">16</th>
<th style="width:30px; text-align:center;">17</th>
<th style="width:30px; text-align:center;">18</th>
<th style="width:30px; text-align:center;">19</th>
<th style="width:30px; text-align:center;">20</th>
<th style="width:30px; text-align:center;">21</th>
<th style="width:30px; text-align:center;">22</th>
<th style="width:30px; text-align:center;">23</th>
<th style="width:30px; text-align:center;">24</th>
<th style="width:30px; text-align:center;">25</th>
<th style="width:30px; text-align:center;">26</th>
<th style="width:33px; text-align:center;">27</th>
<th style="width:33px; text-align:center;">28</th>
<th style="width:33px; text-align:center;">29</th>
<th style="width:33px; text-align:center;">30</th>
<th style="width:33px; text-align:center;">31</th>
</tr>
</table>
</HeaderTemplate>
<ItemTemplate >
<table cellspacing="0" cellpadding="0" border="0">
<tr class ="odd">
<td rowspan =2 style =" width :30px;background:#fff;color:#D8325D; text-align:center;"><%# Eval("NARRAY_NO") %></td>
<td style="width:80px;">用热量</td>
<td style =" width :30px; text-align:center;"><%# Eval("one","{0:F0}") %></td>
<td style =" width :30px; text-align:center;"><%# Eval("two","{0:F0}") %></td>
<td style =" width :30px; text-align:center;"><%# Eval("three", "{0:F0}")%></td>
<td style =" width :30px; text-align:center;"><%# Eval("four", "{0:F0}")%></td>
<td style =" width :30px; text-align:center;"><%# Eval("five", "{0:F0}")%></td>
<td style =" width :30px; text-align:center;"><%# Eval("six", "{0:F0}")%></td>
<td style =" width :30px; text-align:center;"><%# Eval("seven", "{0:F0}")%></td>
<td style =" width :30px; text-align:center;"><%# Eval("eight", "{0:F0}")%></td>
<td style =" width :30px; text-align:center;"><%# Eval("nine", "{0:F0}")%></td>
<td style =" width :30px; text-align:center;"><%# Eval("ten", "{0:F0}")%></td>
<td style =" width :30px; text-align:center;"><%# Eval("eleven", "{0:F0}")%></td>
<td style =" width :30px; text-align:center;"><%# Eval("twelve", "{0:F0}")%></td>
<td style =" width :30px; text-align:center;"><%# Eval("thirtheen", "{0:F0}")%></td>
<td style =" width :30px; text-align:center;"><%# Eval("fourthen", "{0:F0}")%></td>
<td style =" width :30px; text-align:center;"><%# Eval("fifthen", "{0:F0}")%></td>
<td style =" width :30px; text-align:center;"><%# Eval("sixthen", "{0:F0}")%></td>
<td style =" width :30px; text-align:center;"><%# Eval("seventhen", "{0:F0}")%></td>
<td style =" width :30px; text-align:center;"><%# Eval("eighteen", "{0:F0}")%></td>
<td style =" width :30px; text-align:center;"><%# Eval("nintheen", "{0:F0}")%></td>
<td style =" width :30px; text-align:center;"><%# Eval("twenty", "{0:F0}")%></td>
<td style =" width :30px; text-align:center;"><%# Eval("twentyone", "{0:F0}")%></td>
<td style =" width :30px; text-align:center;"><%# Eval("twentytwo", "{0:F0}")%></td>
<td style =" width :30px; text-align:center;"><%# Eval("twentythree", "{0:F0}")%></td>
<td style =" width :30px; text-align:center;"><%# Eval("twentyfour", "{0:F0}")%></td>
<td style =" width :30px; text-align:center;"><%# Eval("twentyfive", "{0:F0}")%></td>
<td style =" width :30px; text-align:center;"><%# Eval("twentysix", "{0:F0}")%></td>
<td style =" width :33px; text-align:center;"><%# Eval("twentyseven", "{0:F0}")%></td>
<td style =" width :33px; text-align:center;"><%# Eval("twentyeight", "{0:F0}")%></td>
<td style =" width :33px; text-align:center;"><%# Eval("twentynine", "{0:F0}")%></td>
<td style =" width :33px; text-align:center;"><%# Eval("thirty", "{0:F0}")%></td>
<td style =" width :33px; text-align:center;"><%# Eval("thirtyone", "{0:F0}")%></td>
</tr>
</ItemTemplate>
</asp:Repeater>
我的repeater里用的table 为何 td里有了数据后 和th对不齐?如何才能让其对齐那? --------------------编程问答-------------------- 你分两个table, 当然对不齐啦,
用一个table就好啦,
还有, 你代码里有标签错误, 用代码整理的工具一整理, 很明显
--------------------编程问答-------------------- 就是的啊,楼主可以合成一俄table做 --------------------编程问答-------------------- <th>是table的表头,理应和表的内容放在一起,
<table cellspacing="0" cellpadding="0" border="0">
<asp:Repeater>
<HeaderTemplate>
<tr>
<th style="width:30px; text-align:center; ">分支名称</th>
<th style="width:80px; text-align :center ;">日期</th>
<th style="width:30px; text-align:center;">1</th>
<th style="width:30px; text-align:center;">2</th>
<th style="width:30px; text-align:center;">3</th>
<th style="width:30px; text-align:center;">4</th>
<th style="width:30px; text-align:center;">5</th>
<th style="width:30px; text-align:center;">6</th>
<th style="width:30px; text-align:center;">7</th>
<th style="width:30px; text-align:center;">8</th>
<th style="width:30px; text-align:center;">9</th>
<th style="width:30px; text-align:center;">10</th>
<th style="width:30px; text-align:center;">11</th>
<th style="width:30px; text-align:center;">12</th>
<th style="width:30px; text-align:center;">13</th>
<th style="width:30px; text-align:center;">14</th>
<th style="width:30px; text-align:center;">15 </th>
<th style="width:30px; text-align:center;">16</th>
<th style="width:30px; text-align:center;">17</th>
<th style="width:30px; text-align:center;">18</th>
<th style="width:30px; text-align:center;">19</th>
<th style="width:30px; text-align:center;">20</th>
<th style="width:30px; text-align:center;">21</th>
<th style="width:30px; text-align:center;">22</th>
<th style="width:30px; text-align:center;">23</th>
<th style="width:30px; text-align:center;">24</th>
<th style="width:30px; text-align:center;">25</th>
<th style="width:30px; text-align:center;">26</th>
<th style="width:33px; text-align:center;">27</th>
<th style="width:33px; text-align:center;">28</th>
<th style="width:33px; text-align:center;">29</th>
<th style="width:33px; text-align:center;">30</th>
<th style="width:33px; text-align:center;">31</th>
</tr>
</HeaderTemplate>
<ItemTemplate >
<tr class ="odd">
<td rowspan =2 style =" width :30px;background:#fff;color:#D8325D; text-align:center;"><%# Eval("NARRAY_NO") %></td>
<td style="width:80px;">用热量</td>
<td style =" width :30px; text-align:center;"><%# Eval("one","{0:F0}") %></td>
<td style =" width :30px; text-align:center;"><%# Eval("two","{0:F0}") %></td>
<td style =" width :30px; text-align:center;"><%# Eval("three", "{0:F0}")%></td>
<td style =" width :30px; text-align:center;"><%# Eval("four", "{0:F0}")%></td>
<td style =" width :30px; text-align:center;"><%# Eval("five", "{0:F0}")%></td>
<td style =" width :30px; text-align:center;"><%# Eval("six", "{0:F0}")%></td>
<td style =" width :30px; text-align:center;"><%# Eval("seven", "{0:F0}")%></td>
<td style =" width :30px; text-align:center;"><%# Eval("eight", "{0:F0}")%></td>
<td style =" width :30px; text-align:center;"><%# Eval("nine", "{0:F0}")%></td>
<td style =" width :30px; text-align:center;"><%# Eval("ten", "{0:F0}")%></td>
<td style =" width :30px; text-align:center;"><%# Eval("eleven", "{0:F0}")%></td>
<td style =" width :30px; text-align:center;"><%# Eval("twelve", "{0:F0}")%></td>
<td style =" width :30px; text-align:center;"><%# Eval("thirtheen", "{0:F0}")%></td>
<td style =" width :30px; text-align:center;"><%# Eval("fourthen", "{0:F0}")%></td>
<td style =" width :30px; text-align:center;"><%# Eval("fifthen", "{0:F0}")%></td>
<td style =" width :30px; text-align:center;"><%# Eval("sixthen", "{0:F0}")%></td>
<td style =" width :30px; text-align:center;"><%# Eval("seventhen", "{0:F0}")%></td>
<td style =" width :30px; text-align:center;"><%# Eval("eighteen", "{0:F0}")%></td>
<td style =" width :30px; text-align:center;"><%# Eval("nintheen", "{0:F0}")%></td>
<td style =" width :30px; text-align:center;"><%# Eval("twenty", "{0:F0}")%></td>
<td style =" width :30px; text-align:center;"><%# Eval("twentyone", "{0:F0}")%></td>
<td style =" width :30px; text-align:center;"><%# Eval("twentytwo", "{0:F0}")%></td>
<td style =" width :30px; text-align:center;"><%# Eval("twentythree", "{0:F0}")%></td>
<td style =" width :30px; text-align:center;"><%# Eval("twentyfour", "{0:F0}")%></td>
<td style =" width :30px; text-align:center;"><%# Eval("twentyfive", "{0:F0}")%></td>
<td style =" width :30px; text-align:center;"><%# Eval("twentysix", "{0:F0}")%></td>
<td style =" width :33px; text-align:center;"><%# Eval("twentyseven", "{0:F0}")%></td>
<td style =" width :33px; text-align:center;"><%# Eval("twentyeight", "{0:F0}")%></td>
<td style =" width :33px; text-align:center;"><%# Eval("twentynine", "{0:F0}")%></td>
<td style =" width :33px; text-align:center;"><%# Eval("thirty", "{0:F0}")%></td>
<td style =" width :33px; text-align:center;"><%# Eval("thirtyone", "{0:F0}")%></td>
</tr>
</ItemTemplate>
</asp:Repeater>
</table>
也就是放在同一个<table>....</table>中!!
补充:.NET技术 , ASP.NET