<col>

  • Revision slug: HTML/Element/col
  • Revision title: col
  • Revision id: 70806
  • Created:
  • Creator: teoli
  • Is current revision? No
  • Comment 1 words added, 1 words removed

Revision Content

The HTML Col Element (<col>) defines a column within a table and is used for grouping and alignment purposes. It is generally found within a {{ HTMLElement("colgroup") }} element.

Attributes

align  {{ unimplemented_inline() }} {{ bug("915") }}
This attribute specifies horizontal alignment of a cell's contents. ({{ unimplemented_inline() }}: Inline attribute style text-align:value also is not supported.)
bgcolor  {{ Non-standard_inline() }} {{ unimplemented_inline() }}
Applies a background color to all cells in the column (IE 5.5 only.)  (Note: use CSS and attribute style background-color:value instead)
char {{ unimplemented_inline() }} {{ bug("915") }}
This attribute is used to set the character to align the cells in a column on. Typical values for this include a period (.) when attempting to align numbers or monetary values.
charoff {{ unimplemented_inline() }} {{ bug("915") }}
This attribute is used to indicate the number of characters to offset the column data from the alignment characters specified by the char attribute.
span 
When present, this attribute applies the attributes of the <col> element to additional consecutive columns.
valign   {{ unimplemented_inline() }} {{ bug("915") }}
This attribute specifies the vertical alignment of the text within the cell. Possible values for this attribute are baseline, bottom, middle, and top. ({{ unimplemented_inline() }}: Inline attribute style vertical-align:value also is not supported.)
width 
This attribute specifies a default width for each column in the current column group. In addition to the standard pixel and percentage values, this attribute might take the special form 0*, which means that the width of each column in the group should be the minimum width necessary to hold the column's contents. Relative widths such as 0.5* also can be used.

Example

    <table border="1" width="400">

      <colgroup>

    <col align="center"width="150" />
    <col align="right" />
      </colgroup>

      <td>This column is aligned to the center.</td>
      <td>This one is aligned to the right.</td>
    <tr>

       <td>!</td>

       <td>?</td>
    </tr>
    <tr>

       <td>!</td>

      <td>?</td>
    </tr>

    </table> 

Notes

Under XHTML 1.0, <col> requires a trailing slash: <col />.

This element should appear within a {{ HTMLElement("colgroup") }}lement, and like that element, it is somewhat of a convenience feature used to set attributes with one or more table columns. In practice, few developers seem to use it.

{{ HTML:Element_Navigation() }}

{{ languages( { "pl": "pl/HTML/Element/col" } ) }}

Revision Source

<p>The HTML Col Element (<span style="font-family: Courier New;">&lt;col&gt;</span>) defines a column within a table and is used for grouping and alignment purposes. It is generally found within a {{ HTMLElement("colgroup") }} element.</p>
<h3 name="Attributes">Attributes</h3>
<dl> <dt>align  {{ unimplemented_inline() }} {{ bug("915") }}</dt> <dd>This attribute specifies horizontal alignment of a cell's contents. ({{ unimplemented_inline() }}: Inline attribute style <a href="/en/CSS/text-align" title="en/CSS/text-align">text-align</a>:<em><span style='"text-align:&lt;span'>value</span></em> also <strong>is not</strong> supported.)</dd>
</dl>
<dl> <dt>bgcolor  {{ Non-standard_inline() }} {{ unimplemented_inline() }}</dt> <dd>Applies a background color to all cells in the column (IE 5.5 only.)  (Note: use CSS and attribute style <a href="/en/CSS/background-color" title="en/CSS/background-color">background-color</a>:<em><span style='"background-color:&lt;span'>value </span></em>instead)</dd>
</dl>
<dl> <dt>char {{ unimplemented_inline() }} {{ bug("915") }}</dt> <dd>This attribute is used to set the character to align the cells in a column on. Typical values for this include a period (.) when attempting to align numbers or monetary values.</dd>
</dl>
<dl> <dt>charoff {{ unimplemented_inline() }} {{ bug("915") }}</dt> <dd>This attribute is used to indicate the number of characters to offset the column data from the alignment characters specified by the <strong>char</strong> attribute.</dd>
</dl>
<dl> <dt>span </dt> <dd>When present, this attribute applies the attributes of the <span style="font-family: Courier New;">&lt;col&gt;</span> element to additional consecutive columns.</dd>
</dl>
<dl> <dt>valign   {{ unimplemented_inline() }} {{ bug("915") }}</dt> <dd>This attribute specifies the vertical alignment of the text within the cell. Possible values for this attribute are <span style="font-family: Courier New;">baseline</span>, <span style="font-family: Courier New;">bottom</span>, <span style="font-family: Courier New;">middle</span>, and <span style="font-family: Courier New;">top</span>. ({{ unimplemented_inline() }}: Inline attribute style <a href="/en/CSS/vertical-align" title="en/CSS/vertical-align">vertical-align</a>:<em><span style='"vertical-align:&lt;span'>value </span></em>also <strong>is not</strong> supported.)</dd>
</dl>
<dl> <dt>width </dt> <dd>This attribute specifies a default width for each column in the current column group. In addition to the standard pixel and percentage values, this attribute might take the special form <span style="font-family: Courier New;">0*</span>, which means that the width of each column in the group should be the minimum width necessary to hold the column's contents. Relative widths such as <span style="font-family: Courier New;">0.5*</span> also can be used.</dd>
</dl>
<h3 name="Example">Example</h3>
<pre>    &lt;table border="1" width="400"&gt;

      &lt;colgroup&gt;

    &lt;col align="center"width="150" /&gt;
    &lt;col align="right" /&gt;
      &lt;/colgroup&gt;

      &lt;td&gt;This column is aligned to the center.&lt;/td&gt;
      &lt;td&gt;This one is aligned to the right.&lt;/td&gt;
    &lt;tr&gt;

       &lt;td&gt;!&lt;/td&gt;

       &lt;td&gt;?&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;

       &lt;td&gt;!&lt;/td&gt;

      &lt;td&gt;?&lt;/td&gt;
    &lt;/tr&gt;

    &lt;/table&gt; 
</pre>
<h3 name="Notes">Notes</h3>
<p>Under XHTML 1.0, <span style="font-family: Courier New;"><code>&lt;col&gt;</code></span> requires a trailing slash: <span style="font-family: Courier New;"><code>&lt;col /&gt;</code></span>.</p>
<p>This element should appear within a {{ HTMLElement("colgroup") }}lement, and like that element, it is somewhat of a convenience feature used to set attributes with one or more table columns. In practice, few developers seem to use it.</p>
<p>{{ HTML:Element_Navigation() }}</p>
<p>{{ languages( { "pl": "pl/HTML/Element/col" } ) }}</p>
Revert to this revision