HTML <colgroup> valignAttribute

HTML colgroup 标签参考手册HTML <colgroup> Tag

Examples

An HTML table with columns of different vertical alignments:

<table border="1" style="height:200px">
  <colgroup valign="top">
  <colgroup valign="bottom">
  <tr>
    <th>Month</th>
    <th>Savings</th>
  </tr>
  <tr>
    <td>January</td>
    <td>$100</td>
  </tr>
</table>

Try it Yourself »

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Only Internet Explorer and Opera support the valign attribute. However, IE and Opera do not support the attribute value "baseline".


Definition and Usage

In HTML5, the <colgroup> valign attribute is not supported.

The valign attribute specifies the vertical alignment of the content in a column group.


Syntax

<colgroup valign="top|middle|bottom|baseline">

Attribute Values

Value Description
top Aligns the content to the top.
middle Aligns the content to the center (default value).
bottom Aligns the content to the bottom.
baseline Aligns with the baseline. The baseline is an imaginary line. In a line of text, most letters are aligned based on the baseline. The baseline value sets all table data in a row to share the same baseline. The effect of this value is often the same as the bottom value. However, if the font sizes of the text differ, the baseline effect will be better. See the illustration below.

Bottom vs. baseline illustration when text font sizes differ:

valign="bottom"

valign="baseline"


HTML colgroup 标签参考手册HTML <colgroup> Tag Other Extensions