TableCaptionAlign 枚举

定义

指定要呈现为 HTML 标题元素的文字的水平或垂直位置。Specifies the horizontal or vertical placement of the text to render as the HTML caption element.

public enum class TableCaptionAlign
public enum TableCaptionAlign
type TableCaptionAlign = 
Public Enum TableCaptionAlign
继承
TableCaptionAlign

字段

Bottom 2

标题元素和表的底部对齐。The caption element is aligned with the bottom of the table.

Left 3

标题元素和表的左边对齐。The caption element is aligned with the left side of the table.

NotSet 0

未设定标题对齐。The caption alignment is not set. 呈现该标题的浏览器确定标题的对齐位置。The browser that renders the caption determines where to align the caption.

Right 4

标题元素和表的右边对齐。The caption element is aligned with the right side of the table.

Top 1

标题元素和表的顶部对齐。The caption element is aligned with the top of the table.

示例

下面的示例演示如何使用TableCaptionAlign枚举设置Table控件中的CaptionAlign属性。The following example demonstrates how to use the TableCaptionAlign enumeration to set the CaptionAlign property in a Table control. Table控件包含TableRow显示城市和邮政编码值的对象。The Table control contains TableRow objects that display City and ZIP Code values.

<%@ page language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>TableCaptionAlign Example</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>

    <h3>TableCaptionAlign Enumeration Example</h3>
    <!-- Scope attribute added for accessibility -->
    <asp:table id="Table1" runat="server" CellPadding="4"
      caption="City Postal Codes" CellSpacing="1"
      captionalign="Right" gridlines="Both">
    <asp:TableRow>
      <asp:TableHeaderCell id="CityHeader" Scope="Column">
        City Name
      </asp:TableHeaderCell>
      <asp:TableHeaderCell id="ZipHeader" Scope="Column">
        ZIP Code
      </asp:TableHeaderCell>
    </asp:TableRow>
    <asp:TableRow>
      <asp:TableCell>
        Redmond
      </asp:TableCell>
      <asp:TableCell>
        98052
      </asp:TableCell>
    </asp:TableRow>
    <asp:TableRow>
      <asp:TableCell>
        Albany
      </asp:TableCell>
      <asp:TableCell>
        12222
      </asp:TableCell>
    </asp:TableRow>
    </asp:table>

    </div>
    </form>
  </body>
</html>
<%@ page language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>TableCaptionAlign Example</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>

    <h3>TableCaptionAlign Enumeration Example</h3>
    <!-- Scope attribute added for accessibility -->
    <asp:table id="Table1" runat="server" CellPadding="4"
      caption="City Postal Codes" CellSpacing="1"
      captionalign="Right" gridlines="Both">
    <asp:TableRow>
      <asp:TableHeaderCell id="CityHeader" Scope="Column">
        City Name
      </asp:TableHeaderCell>
      <asp:TableHeaderCell id="ZipHeader" Scope="Column">
        ZIP Code
      </asp:TableHeaderCell>
    </asp:TableRow>
    <asp:TableRow>
      <asp:TableCell>
        Redmond
      </asp:TableCell>
      <asp:TableCell>
        98052
      </asp:TableCell>
    </asp:TableRow>
    <asp:TableRow>
      <asp:TableCell>
        Albany
      </asp:TableCell>
      <asp:TableCell>
        12222
      </asp:TableCell>
    </asp:TableRow>
    </asp:table>

    </div>
    </form>
  </body>
</html>

注解

GridView Table Calendar DetailsView枚举表示可以呈现为表的控件 (如、、或) 中的 HTML 标题元素的水平或垂直位置。 TableCaptionAlignThe TableCaptionAlign enumeration represents the horizontal or vertical placement of the HTML caption element in controls that can be rendered as tables, such as Table, GridView, DetailsView, or Calendar. 例如, CaptionAlign属性使用这些枚举值设置Table控件中的标题对齐方式。For example, the CaptionAlign property uses these enumeration values to set the caption alignment in a Table control.

如果指定 NotSet, 则呈现控件的浏览器将确定对齐标题的位置。If you specify NotSet, the browser in which the control is rendered determines where to align the caption.

CaptionAlign属性指定 caption 元素相对于可呈现为表的控件的位置。The CaptionAlign property specifies the position of the caption element with respect to controls that can be rendered as tables. Caption属性指定要在 caption 元素中显示的文本。The Caption property specifies the text to display in the caption element. 辅助技术设备可以使用Caption属性提供的说明, 使控件更易于访问。Assistive technology devices can use the description provided by the Caption property to make the control more accessible. 例如, 屏幕阅读器设备可能会将标题读入用户, 以向他们提供表的说明。For example, a screen reader device might read the caption to the user to provide them with a description of the table.

适用于

另请参阅