html - 表格对齐=居中||是的,区别在于<br/>

标签 html css asp.net asp.net-mvc-3 html-table

在 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/

相关文章:

css - <a> 链接元素的底部边距

javascript - 从 gridview 向 javascript 传递参数时服务器标记错误

javascript - 双向绑定(bind)在 AngularJS 1.x 中不起作用

javascript - 在我的主机中加载 3D 模型时出现问题

javascript - jQuery - 如果 left <= 0,将 css 设置为 X 数量

html - 3 列行中的左侧导航列表不适用于内联 block

c# - Visual Studio 2012 条件捆绑

c# - 从字符串 c# 中删除单词

javascript - 在小书签中将 HTML 与 JavaScript 解耦

html - 搜索引擎和/或屏幕阅读器是否重视 HTML5 中的新标签?