简体   繁体   中英

Different table type in C# ASP.NET webform

I am trying to add a table to my web form. When I try to set the properties of the table's cell to display in solution explorer, I don't see the Valign Property mentioned in my book exercise. I see properties that start with "aria". Am I using the wrong type of table?

Someone please guide me.

valign is not valid HTML5, it's been deprecated. Use CSS instead and use the

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

instead.

The HTML way:

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

The ASP.NET WebForms way:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM