Html-colgroup-tag

提供:Dev Guides
移動先:案内検索

HTML-colgroupタグ

説明

HTML <colgroup>タグは、テーブル内の列のグループのプロパティを指定するために使用されます。

colgroup内の列に異なるプロパティを適用する必要がある場合は、colgroupタグ内でHTMLのcolタグを使用できます。

<!DOCTYPE html>
<html>

   <head>
      <title>HTML colgroup Tag</title>
   </head>

   <body>
      <p>This example shows a colgroup that has three columns of different widths:</p>

      <table border = "1">
         <colgroup span = "3">
            <col width = "50"></col>
            <col width = "100"></col>
            <col width = "200"></col>
         </colgroup>

         <tr>
            <td>col 1</td>
            <td>col 2</td>
            <td>col 3</td>
         </tr>
      </table>
   </body>

</html>

これは、次の結果を生成します-

グローバル属性

このタグは、リンク:/html/html_attributes_reference [HTML属性リファレンス]で説明されているすべてのグローバル属性をサポートします

特定の属性

HTML <colgroup>タグは、次の追加属性もサポートしています-

Attribute Value Description
align right left center justify char Defines horizontal alignment, not supported in Html5.
char character Defines a character to use to align text on (use with align = "char"), not supported in Html5.
charoff pixel Specifies an alignment offset (either in pixels or percentage value) against the first character as specified with the char attribute, not supported in Html5.
span number Defines the number of columns the <col> should span, not supported in Html5.
valign bottom middle top baseline Defines vertical alignment, not supported in Html5.
width pixels or % Specifies a default width for each column spanned by the current col element, not supported in Html5 .

イベント属性

このタグは、link:/html/html_events_reference [HTMLイベントリファレンス]で説明されているすべてのイベント属性をサポートしています。

ブラウザのサポート

Chrome Firefox IE Opera Safari Android
Yes Yes Yes Yes Yes Yes