Share via


HtmlTable.Align 속성

정의

웹 페이지의 다른 요소에 상대적으로 HtmlTable 컨트롤의 맞춤 값을 가져오거나 설정합니다.

public:
 property System::String ^ Align { System::String ^ get(); void set(System::String ^ value); };
public string Align { get; set; }
member this.Align : string with get, set
Public Property Align As String

속성 값

웹 페이지의 다른 요소에 상대적인 HtmlTable 컨트롤의 맞춤 값입니다. 기본값은 Empty로, 이 속성이 설정되지 않았음을 나타냅니다.

예제

다음 코드 예제를 사용 하는 방법에 설명 합니다 Align 의 맞춤을 지정 하는 속성은 HtmlTable 웹 페이지의 다른 요소와 관련 하 여 제어 합니다.

<%@ Page Language="C#" AutoEventWireup="True" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">

  void Button_Click(Object sender, EventArgs e)
  {

    // Set the HtmlTable properties according to the
    // user selections.
    Table1.CellSpacing = Convert.ToInt32(SpacingSelect.Value);
    Table1.CellPadding = Convert.ToInt32(PaddingSelect.Value);
    Table1.Align = AlignSelect.Value;

  }

</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
   <title>HtmlTable Example</title>
</head>
<body>

   <form id="form1" runat="server">

      <h3>HtmlTable Example</h3>

      <table id="Table1" 
             style="border-width:1; border-color:Black"
             runat="server">

         <tr>
            <th>
               Column 1
            </th>
            <th>
               Column 2
            </th>
            <th>
               Column 3
            </th>
         </tr>
         <tr>
            <td>
               Cell 1
            </td>
            <td>
               Cell 2
            </td>
            <td>
               Cell 3
            </td>
         </tr>
         <tr>
            <td>
               Cell 4
            </td>
            <td>
               Cell 5
            </td>
            <td>
               Cell 6
            </td>
         </tr>

      </table>
      
      <br /><br /><br /><br /><br /><br /><br /><br />
      
      <hr />

      Select the display settings: <br /><br />

      Align:
      <select id="AlignSelect" 
              runat="server">

         <option value="Left">Left</option>
         <option value="Center">Center</option>
         <option value="Right">Right</option>
        
      </select>

        

      CellPadding:
      <select id="PaddingSelect" 
              runat="server">

         <option value="0">0</option>
         <option value="1">1</option>
         <option value="2">2</option>
         <option value="3">3</option>
         <option value="4">4</option>
         <option value="5">5</option>

      </select>

        

      CellSpacing:
      <select id="SpacingSelect" 
              runat="server">

         <option value="0">0</option>
         <option value="1">1</option>
         <option value="2">2</option>
         <option value="3">3</option>
         <option value="4">4</option>
         <option value="5">5</option>

      </select>
       
      <br /><br />
  
      <input type="button" 
             value="Generate Table"
             onserverclick="Button_Click" 
             runat="server"/>

   </form>

</body>
</html>
<%@ Page Language="VB" AutoEventWireup="True" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">

  Sub Button_Click(ByVal sender As Object, ByVal e As EventArgs)

    ' Set the HtmlTable properties according to the
    ' user selections.
    Table1.CellSpacing = CInt(SpacingSelect.Value)
    Table1.CellPadding = CInt(PaddingSelect.Value)
    Table1.Align = AlignSelect.Value

  End Sub

</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
   <title>HtmlTable Example</title>
</head>
<body>

   <form id="form1" runat="server">

      <h3>HtmlTable Example</h3>

      <table id="Table1" 
             style="border-width:1; border-color:Black"
             runat="server">

         <tr>
            <th>
               Column 1
            </th>
            <th>
               Column 2
            </th>
            <th>
               Column 3
            </th>
         </tr>
         <tr>
            <td>
               Cell 1
            </td>
            <td>
               Cell 2
            </td>
            <td>
               Cell 3
            </td>
         </tr>
         <tr>
            <td>
               Cell 4
            </td>
            <td>
               Cell 5
            </td>
            <td>
               Cell 6
            </td>
         </tr>

      </table>
      
      <br /><br /><br /><br /><br /><br /><br /><br />
      
      <hr />

      Select the display settings: <br /><br />

      Align:
      <select id="AlignSelect" 
              runat="server">

         <option value="Left">Left</option>
         <option value="Center">Center</option>
         <option value="Right">Right</option>
        
      </select>

        

      CellPadding:
      <select id="PaddingSelect" 
              runat="server">

         <option value="0">0</option>
         <option value="1">1</option>
         <option value="2">2</option>
         <option value="3">3</option>
         <option value="4">4</option>
         <option value="5">5</option>

      </select>

        

      CellSpacing:
      <select id="SpacingSelect" 
              runat="server">

         <option value="0">0</option>
         <option value="1">1</option>
         <option value="2">2</option>
         <option value="3">3</option>
         <option value="4">4</option>
         <option value="5">5</option>

      </select>
       
      <br /><br />
  
      <input type="button" 
             value="Generate Table"
             onserverclick="Button_Click" 
             runat="server"/>

   </form>

</body>
</html>

설명

사용 하 여는 Align 의 맞춤을 지정 하는 속성을 HtmlTable 웹 페이지의 다른 요소와 관련 하 여 제어 합니다.

참고

이 속성의 셀에서 내용의 맞춤을 제어 하지 않습니다는 HtmlTable 제어 합니다. 개별 셀 내용의 맞춤을 제어 합니다 AlignVAlign 의 속성을 HtmlTableCell 클래스. 사용 하 여 전체 행에 있는 셀 내용의 맞춤을 제어할 수도 있습니다는 AlignVAlign 의 속성을 HtmlTableRow 클래스입니다.

다음 표에서이 속성에 사용할 수 있는 값을 나열 합니다.

Description
Left 정렬 된 HtmlTable 컨트롤을 웹 페이지의 왼쪽된 가장자리에 합니다.
Center 맞춥니다는 HtmlTable 웹 페이지 중간 제어 합니다.
Right 정렬 된 HtmlTable 컨트롤을 웹 페이지의 오른쪽 가장자리에 합니다.

참고

지정 하는 경우 Left 또는 Right 맞춤, 웹 페이지의 다른 요소는 줄 바꿈이 오른쪽 또는 왼쪽에는 HtmlTable 각각 제어 합니다. 지정 하는 경우 Center 맞춤, 줄 바꿈 없음 발생 및 기타 요소가 컨트롤 아래에 나타납니다.

적용 대상

추가 정보