C# ASP.NET 网络表单中的不同 table 类型

Different table type in C# ASP.NET webform

我正在尝试将 table 添加到我的网络表单中。当我尝试设置 table 单元格的属性以在解决方案资源管理器中显示时,我没有看到书中练习中提到的 Valign Property。我看到以 "aria" 开头的属性。我是否使用了错误类型的 table?

有人请指导我。

valign 无效 HTML5,它已被弃用。请改用 CSS 并使用

vertical-align:alignment (top, bottom, middle)

相反。

HTML方式:

<table>
   <tr>
      <td style="vertical-align:middle;">Vertically centered text</td>
      <td style="vertical-align:top;">Vertically top aligned text</td>
   </tr>
</table>

ASP.NET WebForms 方式:

<asp:Table id="myTable" runat="server">
    <asp:TableRow>
        <asp:TableCell VerticalAlign="Middle">
            Vertically centered text
        </asp:TableCell>
        <asp:TableCell VerticalAlign="Top">
            Vertically top aligned text
        </asp:TableCell>
    </asp:TableRow>
</asp:Table>