HtmlTable.Align プロパティ
アセンブリ: System.Web (system.web.dll 内)

Web ページ上の他の要素を基準とする HtmlTable コントロールの配置。既定値は String.Empty で、このプロパティが設定されていないことを示します。

Align プロパティを使用して、Web ページ上の他の要素を基準とした HtmlTable コントロールの配置を指定します。
![]() |
---|
このプロパティは、HtmlTable コントロールのセルの内容の配置は制御しません。それぞれのセルの内容の配置を制御するには、HtmlTableCell クラスの Align プロパティと VAlign プロパティを使用します。また、行全体のセルの内容の配置を制御するには、HtmlTableRow クラスの Align プロパティと VAlign プロパティを使用します。 |
値 | |
---|---|

Align プロパティを使用して、Web ページ上の他の要素を基準として HtmlTable コントロールの配置を指定する方法を次のコード例に示します。
<%@ Page Language="VB" AutoEventWireup="True" %> <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> <head> <title>HtmlTable Example</title> </head> <body> <form runat="server"> <h3>HtmlTable Example</h3> <table id="Table1" Border="1" BorderColor="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="C#" AutoEventWireup="True" %> <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> <head> <title>HtmlTable Example</title> </head> <body> <form runat="server"> <h3>HtmlTable Example</h3> <table id="Table1" Border="1" BorderColor="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="JScript" AutoEventWireup="True" %> <script runat="server"> function Button_Click(sender : Object, e : EventArgs) { // 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> <head> <title>HtmlTable Example</title> </head> <body> <form runat="server"> <h3>HtmlTable Example</h3> <table id="Table1" Border="1" BorderColor="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>

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


HtmlTable クラス
HtmlTable メンバ
System.Web.UI.HtmlControls 名前空間
CellSpacing
CellPadding
HtmlTableCell
HtmlTableCell.Align
HtmlTableCell.VAlign
HtmlTableRow
HtmlTableRow.Align
HtmlTableRow.VAlign
その他の技術情報
HTML サーバー コントロール
Weblioに収録されているすべての辞書からHtmlTable.Align プロパティを検索する場合は、下記のリンクをクリックしてください。

- HtmlTable.Align プロパティのページへのリンク