在 asp.net 中我创建了一个表:
<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 />
,但是如果我将表格设置为align =“center”,它会...关于为什么会这样的任何想法吗?
最佳答案
Normally, an HTML table will have a break before and after it. The align attribute allows other HTML elements to wrap around the table.
因此,当您使用右对齐时,中断实际上位于表格的左侧。
对齐属性现在为 deprecated所以不应该使用。
将表格样式(包括为 td 和 th 硬编码的所有样式)放入 css 文件中。
关于html - 表格对齐=居中||是的,区别在于<br/>,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16439222/