2013-05-08 43 views
2

差异在asp.net我创建了一个表:table align = center ||没错,在<br />

<table border="1" align="right" class="detailstable StartOnNewPage"> 
     <tr>     
       <td style="text-align:left; width:100px;">Miscellaneous</td> 
       <th style="text-align:right; width:100px" class="FadeOutOnEdit"><%: this.FormatMoney(MiscellaneousItemsTotal) %></th>     
     </tr> 
     <tr>     
       <th style="text-align:right; width:100px;"><%: this.DisplayMiscellaneousPercentage%></th>  
       <td style="text-align:right; width:100px;"><%: this.MiscellaneousToDisplayWithTwoDecimalPlaces%></td> 
     </tr> 
     <tr> 
       <th style="text-align:left; width:100px;">TOTAL</th> 
       <th style="text-align:right; width:100px;"><%: this.FormatMoney(TotalOfAll)%></th>     
     </tr> 
     </table> 

     <br /> 
     <br /> 
     <br /> 

如果表中的对齐设置为“正确”它不拿起3 <br />,但如果我设置表对齐=“中心”它确实......为什么会这样?

+1

为什么你想要三个换行符?那张桌子上的'margin-bottom'呢? – alexn 2013-05-08 11:17:50

+0

我刚刚试过

但它没有改变任何东西? – John2013-05-08 12:20:36

+0

http://jsfiddle.net/9XBEq/1/检查这一个边距:底部正在与对齐:中心和对齐:正确 – 2013-05-08 12:58:48

回答

2

通常,HTML表格在它之前和之后都会有一个中断。 align属性允许其他HTML元素环绕表格。

因此,当您使用右对齐时,您的休息时间实际上位于表格的左侧。

对齐属性现在是deprecated所以不应该使用。

将您的表格样式,包括td和th硬编码的所有样式放入您的css文件中。

+0

好吧谢谢你,虐待尝试CSS方法感谢 – John 2013-05-08 12:21:07

0

AS @Joe R表示它是有偏倚的,我建议你使用来达到这个目的。