HTML <colgroup> align 属性
标签" href="tag-main.html"><main>
<map>
<mark>
<menu>
<meta>
<meter>
<nav>
<noframes>
<noscript>
<object>
<ol>
<optgroup>
<option>
<output>
<p>
<param>
<pre>
<html>
<picture>
<progress>
<q>
<rp>
<rt>
<ruby>
<s>
<samp>
<script>
<section>
<select>
<small>
<source>
<span>
<strike>
<strong>
<style>
<sub>
<summary>
<sup>
<table>
<tbody>
<td>
<textarea>
< template>
<tfoot>
<th>
<thead>
<time>
<title>
<tr>
<track>
<tt>
<u>
<ul>
<var>
<video>
<wbr>
HTML <colgroup> align 属性
实例
两个 <colgroup> 元素为表格中的三列规定了不同的对齐方式(注意第一个 <colgroup> 元素横跨两列):
<table width="100%" border="1">
<colgroup span="2" align="left"></colgroup>
<colgroup align="right"></colgroup>
<tr>
<th>ISBN</th>
<th>Title</th>
<th>Price</th>
</tr>
<tr>
<td>3476896</td>
<td>My first HTML</td>
<td>$53</td>
</tr>
</table>
<colgroup span="2" align="left"></colgroup>
<colgroup align="right"></colgroup>
<tr>
<th>ISBN</th>
<th>Title</th>
<th>Price</th>
</tr>
<tr>
<td>3476896</td>
<td>My first HTML</td>
<td>$53</td>
</tr>
</table>
浏览器支持
只有 Opera 和 Internet Explorer 8 及之前的版本(IE 9 不支持)支持 align 属性(IE 9 不支持)。
定义和用法
在 HTML5 中,不支持 <colgroup> align 属性。
align 属性规定列组中的内容的水平对齐方式。
语法
<colgroup align="left|right|center|justify|char">
属性值
| 值 | 描述 |
|---|---|
| left | 左对齐内容(默认值)。 |
| right | 右对齐内容。 |
| center | 居中对齐内容(th 元素的默认值)。 |
| justify | 对行进行伸展,这样每行都可以有相等的宽度(就像在报纸和杂志中)。 |
| char | 将内容对准指定字符。 |
HTML <colgroup> 标签